Secret storage and retrieval
Secrets Manager stores secret values with version metadata and access controls. Applications retrieve secrets using an authorized identity instead of embedding them in source. Retrieval should minimize unnecessary calls and avoid writing values into logs, errors, screenshots, or shell history. For example, an application uses an execution role to retrieve a database credential at runtime rather than commit its password in config.py.
An application uses an execution role to retrieve a database credential at runtime rather than commit its password in config.py.
A web application starts with an AWS workload identity rather than a database password in its image. It calls Secrets Manager for a named secret, receives the permitted current value, and uses it to establish a database connection. The secret retrieval path and the database authentication path can fail independently, so log only identifiers and error categories needed to distinguish them.
A secret is sensitive configuration requiring controlled access. A secret version is one stored value with version metadata. Caching retains a retrieved value temporarily to reduce latency and calls. Caching improves efficiency but creates refresh responsibilities when the value changes. Avoid indefinitely persisting a credential in a local file or printing it on startup. Least privilege should scope retrieval to the required secret, with any relevant KMS permissions considered. Moving a password out of source is progress, but it does not solve compromised workload identity, excessive retrieval access, or logs that reveal the credential after retrieval.
An application uses an execution role to retrieve a database credential at runtime rather than commit its password in config.py.
Do not overlook this operational distinction: Retrieval should minimize unnecessary calls and avoid writing values into logs, errors, screenshots, or shell history.