Sub topic 12
Choosing between Parameter Store and Secrets Manager
This chapter assumes you can create parameters and secrets with the AWS CLI, read basic IAM policies, and know the difference between configuration values and secrets. The goal is a repeatable way to decide which service holds each value.
The short version
Both services store values encrypted with AWS KMS, control access with IAM, and log calls to CloudTrail. They differ in what they do for you after the value is stored.
- Parameter Store is a hierarchical key-value store. Standard parameters carry no charge. It suits configuration, feature flags, and secrets that you rotate yourself.
- Secrets Manager is a managed secret vault. It charges per secret and per API call. It adds built-in rotation, versioning with staging labels, and cross-Region replication.
Comparing the two
| Need | Parameter Store | Secrets Manager |
|---|---|---|
| Plain configuration (hostnames, flags) | Best fit | Works, but costs more |
| Automatic rotation | No built-in rotation | Built in, using a Lambda function |
| Value size | 4 KB standard, 8 KB advanced | Up to 64 KB |
| Cost | Standard tier is free | Charged per secret per month, plus API calls |
| Versioning | Version numbers and labels | Version IDs and staging labels such as `AWSCURRENT` |
| Multi-Region replication | Not built in | Built in |
| Hierarchy and path queries | Yes, `get-parameters-by-path` | Names only, no path query |
Check current limits and prices on the AWS pricing and quotas pages before you commit, because they change.
A decision flow
Ask these questions in order. Stop at the first one that applies.
Applying the rules
Use Parameter Store when the value is configuration, or when you need to load many values under one path in a single call:
aws ssm get-parameters-by-path \
--path /myapp/prod \
--recursive \
--with-decryptionUse Secrets Manager when a credential must change on a schedule without an application release. A database password is the typical case. The rotation function updates the database and the secret together, and applications that read the AWSCURRENT version pick up the new value.
aws secretsmanager create-secret \
--name myapp/prod/db \
--secret-string '{"username":"app","password":"REPLACE_ME"}'You can mix both in one application. A common layout keeps /myapp/prod/db/host in Parameter Store and myapp/prod/db in Secrets Manager, and your code reads each from the place that fits.
Common mistakes
- Putting every value in Secrets Manager. Hundreds of non-secret settings add monthly cost and API charges for no benefit.
- Storing a rotating credential as a SecureString. Nothing rotates it, so it goes stale or someone changes it by hand.
- Choosing by habit instead of by requirement. Write down whether you need rotation, replication, or a value larger than 8 KB, then decide.
- Treating the choice as permanent. Parameter Store can read a secret through the
/aws/reference/secretsmanager/prefix, so code that already uses the SSM API can move a value to Secrets Manager later without changing its read path.
Exercise
Your team stores a third-party API key that must be replaced every 30 days with no application redeploy, and it must be available in two Regions. Which service do you pick, and which two requirements drive that choice?
Show answer
Secrets Manager. Managed automatic rotation covers the 30-day replacement, and built-in multi-Region replication covers the second Region. Parameter Store has neither feature built in.
Exercise
An application has 200 non-secret settings, such as endpoints, timeouts, and feature flags. Where should they go, and how can the application load them at startup?
Show answer
Put them in Parameter Store as String parameters under a path such as /myapp/prod. The application loads them with get-parameters-by-path and the recursive option. Standard parameters have no charge, and one path query reads many values.