"Passwords belong in the code." They never do. Code gets copied, shared, pasted into tickets and pushed to Git, and every copy carries the password. One leaked repository, one public fork, and the database password is public. Rotating it then means a code change and a redeploy. AWS gives you two better places: AWS Secrets Manager and Parameter Store, a capability of AWS Systems Manager. In both, your application fetches the value at runtime, with IAM deciding who may read it.
Parameter Store
Parameter Store holds configuration values and simple secrets in a hierarchy such as /myapp/prod/db-host.
- Standard parameters: up to 10,000 per account and Region, values up to 4 KB, and no additional charge.
- Advanced parameters: up to 100,000, values up to 8 KB, parameter policies (such as expiration) and cross-account sharing, for a charge.
- SecureString parameters are encrypted with a KMS key, so the value is stored encrypted and only principals allowed to use the key can decrypt it.
It is ideal for feature flags, endpoints, and static secrets that rarely change.
Secrets Manager
Secrets Manager is built only for secrets, and it adds what Parameter Store lacks:
- Automatic rotation on a schedule. For databases such as Amazon RDS, Aurora, Redshift and DocumentDB, Secrets Manager offers ready-made rotation functions; for other kinds of secret you write a rotation Lambda function.
- Replication of a secret to other Regions, for multi-Region applications and disaster recovery.
- Native integrations, for example RDS can keep the master user password in Secrets Manager for you.
It costs about $0.40 per secret per month, plus $0.05 per 10,000 API calls. Cache secrets in your application (AWS provides caching clients) so you don't call the API on every request.
Which one to choose
- Plain config, or a few static values that rarely change: Parameter Store.
- Database passwords and credentials that should rotate, or secrets you need in several Regions: Secrets Manager.
- Many teams use both: config in Parameter Store, credentials in Secrets Manager.
A common mistake is moving the password out of the code and into a plain environment variable in the task definition or Lambda console, where anyone who can view the configuration can read it. Store a reference (the secret ARN or parameter name) and fetch the value at runtime instead.
Where AI fits
Never paste API keys into a prompt. Prompts can be stored in chat histories, application logs and, if enabled, model invocation logs, and anything in a prompt can end up in a model's answer. The same rule applies to AI agents that call external tools: the agent should not see the raw key. Amazon Bedrock AgentCore Identity keeps outbound credentials in a token vault; for API keys it creates and manages a secret in Secrets Manager in your account (or references one you already have), and the agent's code retrieves it at runtime under IAM control.
Quick recap
- No secrets in code, tickets or prompts.
- Parameter Store: config and simple secrets; standard tier at no extra cost; SecureString uses KMS.
- Secrets Manager: rotation and replication, about $0.40 per secret per month.
- Fetch secrets at runtime and let IAM decide who can read them.