HashiCorp Cloud Platform
Configure HCP Vault Dedicated audit log streaming to Amazon CloudWatch
Prerequisites
To configure audit logs streaming to Amazon CloudWatch, you will need to have:
A HCP account with the Admin role assigned
An essentials or standard tier HCP Vault Dedicated cluster
Access to AWS with permission to create IAM policies and users
Configure AWS
To configure HCP Vault Dedicated audit log 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": "HCPLogStreaming", "Effect": "Allow", "Action": [ "logs:PutLogEvents", "logs:DescribeLogStreams", "logs:DescribeLogGroups", "logs:CreateLogStream", "logs:CreateLogGroup", "logs:TagLogGroup" ], "Resource": "*" } ] }Click Next.
Enter
hcp-vault-log-streamingin the Policy name textbox and click Create policy.
Create IAM user
From the IAM Dashboard, click Users.
Click Add users.
Enter
hcp-vault-log-streamingin the User name textbox and click Next.Click the Attach policies directly radio button.
Search for the
hcp-vault-log-streamingpolicy, click the checkbox, and click Next.Click Create user.
Click the hcp-vault-log-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 audit log streaming in the HCP Portal.
Enable audit logs 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 Audit Logs.
Click Enable log Streaming.
From the Enable audit logs streaming 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.
Refer to the CloudWatch documentation for details on log exploration.
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"
audit_log_config {
cloudwatch_access_key_id = "actual-access-key-id"
cloudwatch_secret_access_key = "actual-secret-access-key"
cloudwatch_region = "countrycode-region-#"
}
}
Edit the audit log streaming configuration (optional)
To edit a audit log streaming integration, perform the following steps.
From the Audit Logs page, click on the Manage drop-down, then Edit configuration.
Edit the configuration, then click Save.
Disable audit log streaming (optional)
To disable a audit log streaming integration, from the Audit Logs page, click on the Manage drop-down, then Disable streaming.