AWS Secrets Manager

AWS Secrets Manager stores, rotates, and retrieves secrets — database credentials, API keys, OAuth tokens — via a managed service with IAM-governed access and KMS encryption. It removes the need to check secrets into code or configuration, and makes credential rotation an automated, auditable process.


Key Features:


Secrets Manager vs. Parameter Store:


Common Patterns:


Example: Retrieve a Secret


import boto3, json

sm = boto3.client("secretsmanager", region_name="us-west-2")
raw = sm.get_secret_value(SecretId="prod/app/db")["SecretString"]
creds = json.loads(raw)

# creds = {"username": "app", "password": "...", "host": "...", "port": 5432}