Sub topic 1
Configuration versus secrets: what goes where
Prerequisites
This chapter assumes you know what an AWS account, a Region, and an IAM role are. You should be able to read JSON and run AWS CLI commands. You should also know the twelve-factor idea that configuration lives in the environment and not in code.
Why the split matters
Every application needs values that change between environments. AWS offers two services for them: Systems Manager Parameter Store and AWS Secrets Manager. Choosing between them starts with one question: what happens if this value leaks?
- Configuration is a value that changes behavior but gives no access on its own. Examples are a database host name, a feature flag, a log level, or a timeout.
- A secret is a value that proves identity or grants access. Examples are a database password, an API token, or a private key.
Anyone who reads a configuration value learns how your system is set up. Anyone who reads a secret can act as your application. That difference sets how tightly you control access, how you encrypt, and whether the value must be changed on a schedule.
A quick test
Ask three questions about a value:
- Could someone use it to authenticate or decrypt something?
- Would you need to change it urgently after a leak?
- Is it safe to see in a pull request or a log line?
If the answer to the first is yes, or to the third is no, treat the value as a secret.
Worked example
Take a service that connects to a database. It needs four values.
| Value | Kind | Likely home |
|---|---|---|
| Database host name | Configuration | Parameter Store, String |
| Connection timeout in seconds | Configuration | Parameter Store, String |
| Database username and password | Secret | Secrets Manager, or Parameter Store SecureString |
| Third-party API token | Secret | Secrets Manager, or Parameter Store SecureString |
The host and timeout can sit under a path such as /myapp/prod/db/. The password needs encryption, narrow IAM access, and ideally rotation. A later chapter compares the two services in detail. For now, only the classification matters.
Common mistakes
- Treating "internal" as "safe." An internal host name is configuration. An internal admin password is still a secret.
- Putting secrets in code, container images, or environment variables baked into templates. These copies spread to repositories, build logs, and image registries, and you cannot recall them.
- Encrypting everything. Encrypting plain configuration adds KMS cost and makes debugging harder, with no security gain.
- Mixing both kinds under one permission. If a role can read configuration, it should not automatically read secrets. Keep secrets under separate paths or names so IAM policies can tell them apart.
Summary
Classify first, then choose storage. Configuration is cheap to store and safe to read widely. Secrets need encryption, restricted access, and a plan for replacement. The next chapters build on this split.
Exercise
Your app needs a feature flag called ENABLE_BETA, a Stripe API key, and the AWS Region name. Which of these are configuration and which is a secret?
Show answer
ENABLE_BETA and the Region name are configuration, because leaking them gives no access. The Stripe API key is a secret, because anyone holding it can make requests as your account. It needs encryption and tight access control.