AWS Secrets Manager
often confused with SSM Parameter StoreA managed store for secrets. Each secret has versions marked with staging labels; applications call GetSecretValue at run time and get the AWSCURRENT version.
- Every version is encrypted with a KMS key:
aws/secretsmanagerby default, or a customer managed key. - Reading needs
secretsmanager:GetSecretValueandkms:Decrypton the key. - A resource policy on the secret allows other accounts;
BlockPublicPolicyrejects policies that would open it widely. - Replicate to other Regions: rotation runs on the primary and the new value flows to replicas; each replica can use a key in its own Region.
- Reference secrets without code: CloudFormation dynamic references, ECS task definitions, the Lambda extension, and RDS managed master user passwords.
| Secrets Manager | Parameter Store | |
|---|---|---|
| Built-in rotation | Yes (managed or Lambda) | No |
| Encryption | Always (KMS) | Only SecureString |
| Cross-account | Resource policy | Advanced tier sharing |
| Multi-Region | Replicas | No |
| Cost | Per secret per month + API calls | Standard tier free |
- Sharing a secret with another account while it uses
aws/secretsmanager: the other account can’t use that key. Use a customer managed key and allow the other account in its key policy too. - Granting
GetSecretValuebut forgettingkms:Decrypt(for a customer managed key). - Putting secrets in Lambda environment variables or AMIs: they leak through describe calls, images and logs.
- Fetching the secret on every request: cache it (client-side caching libraries or the Parameters and Secrets Lambda extension).
- Deleting a secret and expecting it gone at once: there is a recovery window (7–30 days) unless you force deletion without recovery.
- Database credentials with automatic rotation.
- Third-party API keys used by many services.
- RDS master password created and rotated by RDS itself.