Sync secrets from Vault to AWS Secrets Manager
The AWS Secrets Manager destination enables Vault to sync and unsync secrets of your choosing into an external AWS account. When configured, Vault will actively maintain the state of each externally-synced secret in near-realtime. This includes sending new secrets, updating existing secret values, and removing secrets when they either get dissociated from the destination or deleted from Vault. This enables the ability to keep control of all your secrets localized while leveraging the benefits of the AWS Secrets Manager.
Prerequisites:
- Ability to read or create KVv2 secrets
- Ability to create AWS IAM user and access keys with access to the Secrets Manager
- Ability to create sync destinations and associations on your Vault server
Setup
Navigate to the AWS Identity and Access Management (IAM) console to configure a IAM user with access to the Secrets Manager. The following is an example policy outlining the required permissions to use secrets syncing.
Configure a sync destination with the IAM user credentials created in the previous step.
Output:
Usage
If you do not already have a KVv2 secret to sync, mount a new KVv2 secrets engine.
Output:
Create secrets you wish to sync with a target AWS Secrets Manager.
Output:
Create an association between the destination and a secret to synchronize.
Output:
Navigate to the Secrets Manager in the AWS console to confirm your secret was successfully synced.
Moving forward, any modification on the Vault secret will be propagated to its AWS Secrets Manager counterpart. Creating a new secret version in Vault will update the one in AWS to the new version. Deleting either the secret or the association in Vault will delete the secret in your AWS account as well.
Access management
You can allow or restrict access to secrets by attaching AWS Resource Tags to secrets. For example, the following AWS IAM policy prevents Vault from modifying secrets that were not created by a sync operation:
To prevent out-of-band overwrites, we recommend adding a negative condition on all write-access policies not used by Vault:
Use wildcards with extreme caution
The previous examples use wildcards for the sake of brevity. We strongly recommend you use the principle of least privilege to restrict actions and resources for each use case to the minimum necessary requirements.
Tutorial
Refer to the Vault Enterprise Secrets Sync tutorial to learn how to configure the secrets sync between Vault and AWS Secrets Manager.
API
Please see the secrets sync API for more details.