Sub topic 1
Configuration versus secrets: what goes where
Prerequisites
Assume you know basic AWS accounts, Regions, IAM roles, the AWS CLI, JSON, and environment variables. You should also understand that an application role receives permissions through IAM policies.
Configuration versus secrets: what goes where
Configuration controls how an application runs. Examples include a database hostname, log level, feature flag, or timeout. These values may still need access control, but they are usually safe to expose to operators.
A secret is sensitive authentication material, such as a password, API token, or private key. Do not place secrets in source code, container images, Git history, or ordinary environment variables when a managed secret store is available.
AWS provides two related services:
- Parameter Store stores configuration parameters and can encrypt sensitive values.
- Secrets Manager stores secrets and provides features designed for secret versions and rotation.
Parameter Store basics: names, paths, and hierarchies
A Parameter Store name can include a hierarchy separated by /. A consistent path groups values by application and environment:
/myapp/prod/db/host
/myapp/prod/db/port
/myapp/prod/db/passwordThe hierarchy is part of the name, not a directory on a filesystem. You can retrieve one parameter or read all parameters below a path. Path-based IAM permissions also help limit an application to one environment.
aws ssm put-parameter \
--name /myapp/prod/db/host \
--value db.example.internal \
--type String
aws ssm get-parameters-by-path \
--path /myapp/prod \
--recursiveParameter types and tiers
Parameter Store supports these value types:
Stringstores one text value.StringListstores comma-separated values. It is not a general JSON list.SecureStringencrypts the value with AWS KMS. Use it for sensitive values that do not need Secrets Manager features.
Parameters use Standard or Advanced tiers. Advanced supports larger values and additional capabilities, but it can incur charges. Check current service limits before designing around a maximum size.
Secrets Manager basics: creating and storing secrets
Secrets Manager is intended for credentials and other secrets. A secret can contain a JSON document with related fields, such as a username and password:
aws secretsmanager create-secret \
--name myapp/prod/db \
--secret-string '{"username":"app","password":"REPLACE_ME"}'Secrets Manager tracks secret versions and supports staging labels. It also integrates with automatic rotation, which can change credentials without requiring a new application image. Store related credentials together when consumers need them as one unit.
Exercise
Where should a database hostname and database password normally be stored?
Show answer
Store the hostname as a String parameter in Parameter Store and the password in Secrets Manager or as a SecureString parameter, depending on whether rotation is required.