Secrets Manager and Parameter Store
Storing secrets and configuration on AWS: versions and staging labels, rotation, access control, caching, limits, and choosing between the two services.
Encryption with KMSWorkload identity for EC2, Lambda and CIECS task definitions and services
Secrets Manager and Parameter Store
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Applications should fetch secrets at run time using their IAM role, not carry them in code, images or plaintext environment variables.
- Secrets Manager adds rotation, cross-Region replication and cross-account access, for a monthly charge per secret.
- Parameter Store holds configuration and SecureString values in a hierarchy, with no added charge for standard parameters and no rotation.
- A secret's versions are labelled AWSCURRENT, AWSPREVIOUS and AWSPENDING, which is what lets rotation happen without a gap.
- Cache values in the application. Parameter Store's default read throughput is 40 calls a second shared across its read APIs.
- Rotation only helps if clients pick up the new value.
The password has to live somewhere
Your service needs a database password and a payment API key. Put them in the code and they’re in Git forever. Put them in the image or a plain environment variable and anyone who can read the deployment can read them. The general problem has one good shape: keep secrets in a store, let the workload prove who it is, and hand them out at run time.
On AWS the proof is the workload’s IAM role, so there’s no bootstrap password. Values are encrypted with KMS, and reads are logged in CloudTrail.
Two stores
AWS Systems Manager Parameter Store is a hierarchical key-value store: names like /shop/prod/feature/limit, typed String, StringList or SecureString. You can grant access by path and fetch a whole subtree. Standard parameters (up to 4 KB, 10,000 per account and Region) have no extra charge; advanced ones (8 KB, with expiry policies) do.
AWS Secrets Manager is built for credentials: rotation, replication to other Regions, resource policies for cross-account access, values up to 64 KB. In eu-west-1 it costs $0.40 per secret per month plus $0.05 per 10,000 API calls, as of November 2026.
AWS’s own advice is to use Secrets Manager for credentials. A sensible split: configuration in Parameter Store, anything that grants access in Secrets Manager. A third service, AppConfig, suits configuration you change and roll out often.
Versions are what make rotation safe
A secret keeps versions tracked by staging labels. I tried this on moto, a local emulator, creating shop/db and then writing a second value:
AWSCURRENT: {"password":"second"}
AWSPREVIOUS: {"password":"first"}
Readers ask for AWSCURRENT by default. During rotation the new value sits as AWSPENDING until it’s been set on the database and tested, then the label moves.
Managed rotation, offered for some services such as Aurora master passwords, needs no code. Otherwise a rotation Lambda does the steps. With a single database user there is a brief moment where the old password has stopped working; alternating between two users avoids it.
Deleting is deliberately slow. A deleted secret is unreadable at once but recoverable for at least 7 days. On moto, reading it after deletion failed with InvalidRequestException, and restore-secret brought it back.
Reading well
aws ssm get-parameters-by-path --path /shop/prod --recursive --with-decryption
Without --with-decryption, a SecureString comes back as ciphertext (moto fakes that with a readable prefix, so don’t judge the encryption by it). With it, the caller needs permission to decrypt with the key.
ECS and EKS can inject values, CodeBuild can map them into a build, and CloudFormation can reference them at deploy time. For your own code:
- Cache. Load once, refresh every few minutes, refetch on an authentication error. There is an agent and a Lambda extension for this.
- Mind the quota. Parameter Store allows 40 reads a second by default, shared by
GetParameter,GetParametersandGetParametersByPath. Higher throughput can be switched on, for a fee. - Scope tightly. One role, its own paths or secrets, nothing like
secretsmanager:*on*. - Never log the value, including in error messages.
Better than a secret is no secret
Where a service supports IAM authentication, or a temporary token, prefer it: nothing to store or rotate. Secrets Manager is for what’s left.
Across accounts and Regions
A workload in a second Region can read a replica of a Secrets Manager secret, kept in step with the primary and promotable to a standalone secret during recovery. To share across accounts, attach a resource policy to the secret and use a customer managed KMS key whose policy also admits the other account. Both sides have to allow it. Keep separate secrets per environment, so that access to development never implies access to production.
About the video
The embed is DheerajTechInsight’s “AWS Secrets Manager Deep Dive”, November 2025, 22 minutes. Its chapters cover what Secrets Manager is, the problem with hard-coded credentials, comparison with Parameter Store, how it works, secret types, automatic rotation, a demo, versioning and recovery, and best practices. I judged it from chapters and description only, since transcripts couldn’t be fetched. English was judged from the “English (US) original” audio track. A short AWS episode is in deeper.
What was run: version labels, delete and restore, and the parameter commands ran on moto 5.1.22, an emulator with no real encryption or IAM enforcement. Limits and rotation behaviour are from the AWS docs; the price is from the AWS Price List file, all checked 2026-11-29.
Where this fits
Secrets reduce what can leak. The next lesson covers noticing and blocking attacks: threat detection and edge protection.
Check yourself
A role can call GetSecretValue on a secret encrypted with a customer managed KMS key and still gets access denied. Why?
It also needs permission to decrypt with that key, granted through the key policy or IAM. Reading the secret involves both services.
After rotation, some instances fail to connect to the database for an hour. What is the likely design flaw?
They read the secret once at startup and kept it, and the old credential stopped working. Cache with a refresh interval, and refetch on authentication failure. An alternating-users rotation strategy also leaves the previous credential valid for a while.
Why is a SecureString injected into a container as an environment variable still exposed?
It is encrypted at rest and in transit to the agent, but inside the container it is plaintext in the process environment, which can be dumped or logged. Restrict who can exec into containers and never log the environment.
Every Lambda invocation calls GetParameter and you start seeing throttling. What do you do?
Fetch outside the handler and cache, or use the Parameters and Secrets Lambda extension. Raising the throughput setting also works but costs money and leaves the waste in place.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.