Amazon Web Services
AWS-20 intermediate
Protect secrets with AWS KMS and Secrets Manager
Create a customer managed KMS key with rotation, encrypt and decrypt data from the CLI, store database credentials in Secrets Manager encrypted with your key, give a Lambda function least-privilege access to read them, and rotate the secret.
What you'll do
- Create a customer managed key, alias and automatic rotation
- Encrypt and decrypt with KMS
- Store and retrieve a secret encrypted with your key
- Grant least-privilege access (secretsmanager:GetSecretValue + kms:Decrypt)
- Rotate a secret without changing application code
Lab tasks
-
1
Create the key
app-secrets-key - 2 Turn on automatic key rotation
- 3 Encrypt and decrypt from the CLI
- 4 Store the database credentials
- 5 Retrieve the secret value in the console
- 6 Run the job – AccessDenied
- 7 Grant least privilege and run again
- 8 Rotate the secret