This guide explains how to configure HashiCorp Vault for automatic unsealing using AWS KMS, enhancing security and reducing operational overhead.
In this guide, you’ll configure HashiCorp Vault to use AWS KMS for automatic unsealing. By leveraging Cloud Auto Unseal, you eliminate the operational overhead of manual unseal keys and enhance your security posture.
In the AWS Console, go to KMS → Customer managed keys and copy your CMK ARN (for example: arn:aws:kms:us-east-1:123456789012:key/abcd1234-5678-90ab-cdef-EXAMPLEKEY).
Treat your KMS key ARN and Vault configuration file as sensitive information. Do not expose them in public repositories.
Edit the Vault HCL:
Copy
Ask AI
sudo vi /etc/vault.d/vault.hcl
Insert the awskms seal stanza anywhere in the file:
Copy
Ask AI
seal "awskms" { region = "us-east-1" kms_key_id = "arn:aws:kms:us-east-1:123456789012:key/abcd1234-5678-90ab-cdef-EXAMPLEKEY"}
Recovery Key 1: qDfLTvJNhT3Dgj8UWaep9o2qgQZcVq/+w6QXQ4Tq+...Recovery Key 5: 2/FshgVlCzLhqhG+C0M0azU3ry82c2KhmKSUpelvInitial Root Token: s.7gu7dshRlK1KNoq8B9dFmeSuccess! Vault is initialized with 5 recovery shares and a threshold of 3.
Re-run vault status:
Copy
Ask AI
vault status
Copy
Ask AI
Key Value--- -----Seal Type awskmsRecovery Seal Type shamirInitialized trueSealed falseTotal Recovery Shares 5Threshold 3Version 1.7.1Storage Type raftCluster Name vault-prod-us-east-1Cluster ID 6245bbfd-8db5-b507-f689-ba48628ad2a5HA Enabled trueHA Cluster http://10.0.1.37:8201HA Mode active
Vault remains unsealed thanks to AWS KMS auto-unseal, eliminating manual recovery.Congratulations! You’ve successfully set up Cloud Auto Unseal with AWS KMS. This configuration streamlines your Vault operations and boosts security by removing manual unseal key handling.