HashiCorp Cloud Platform
Configure HCP Vault Dedicated metric streaming to Amazon CloudWatch
For details on metrics scope and interpretation, see the HCP Vault Dedicated metrics documentation.
Availability
HCP Vault Dedicated metrics streaming is available for all production grade clusters. The feature is not available for Development tier clusters.
Prerequisites
To configure metric streaming to Amazon CloudWatch, you will need to have:
A HCP account with Admin or Contributor role assigned in HCP
A production grade HCP Vault Dedicated cluster
Access to AWS with permission to create IAM policies and users
Note
If you do not have a cluster running, refer to the Create a Vault Cluster on HCP or the Deploy HCP Vault Dedicated with Terraform tutorial to create an HCP Vault Dedicated cluster.
Configure AWS
To configure HCP Vault Dedicated metric streaming to Amazon CloudWatch, you must provide an access and secret key for an IAM user assigned permission to CloudWatch.
Create IAM policy
Log in to the AWS Management Console and navigate to the IAM Dashboard.
Click Policies, then click Create policy.
Click the JSON tab and paste the IAM policy into the Policy editor textbox overwriting any sample text.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "HCPMetricStreaming", "Effect": "Allow", "Action": [ "cloudwatch:ListMetrics", "cloudwatch:ListMetricStreams", "cloudwatch:ListTagsForResource", "cloudwatch:PutMetricData", "cloudwatch:PutMetricStream", "cloudwatch:TagResource" ], "Resource": "*" } ] }
Click Next.
Enter
hcp-vault-metric-streaming
in the Policy name textbox and click Create policy.
Create IAM user
From the IAM Dashboard, click Users.
Click Add users.
Enter
hcp-vault-metric-streaming
in the User name textbox and click Next.Click the Attach policies directly radio button.
Search for the
hcp-vault-metric-streaming
policy, click the checkbox, and click Next.Note
This document has you attach the policy directly to the IAM user for ease of following the documentation.
The recommended practice is to create an IAM group, attach the policy to the group, and add the user to the group.
Click Create user.
Click the hcp-vault-metric-streaming user in the Users list.
Click the Security credentials tab and click Create access key.
Select Application running outside AWS and click Next.
Click Create access key.
Securely store the Access key and Secret access key values - you will need this to configure metric streaming in the HCP Portal.
Enable metrics streaming
Log in to the HCP Portal and navigate to the Vault clusters page.
Click the Vault cluster you wish to enable streaming for and click Metrics.
Click Enable metric streaming.
From the Stream Vault metrics view, select Amazon CloudWatch as the provider and click Next.
Under Add provider details, enter the Access key ID and Secret access key created in the Create IAM user section, then select the Region that matches your existing CloudWatch environment.
Click Save.
Note
At this time, HCP Vault Dedicated only supports metrics streaming to one metrics endpoint at a time.
Example Terraform configuration (optional)
Refer to the Terraform Registry hcp_vault_cluster
documentation
for more information.
resource "hcp_vault_cluster" "example" {
cluster_id = "vault-cluster"
hvn_id = hcp_hvn.example.hvn_id
tier = "standard_large"
metrics_config {
cloudwatch_access_key_id = "actual-access-key-id"
cloudwatch_secret_access_key = "actual-secret-access-key"
cloudwatch_region = "countrycode-region-#"
}
}
Edit the metrics streaming configuration (optional)
To edit a metrics streaming integration, perform the following steps.
From the Metrics page, click on the Manage drop-down, then Edit configuration.
Edit the configuration, then click Save.
Disable metrics streaming (optional)
To disable a metrics streaming integration, from the Metrics page, click on the Manage drop-down, then Disable streaming.