Skill 1.1.4
Managing build and deployment secrets (for example, AWS Secrets Manager, AWS Systems Manager Parameter Store)
Key Concepts
In a buildspec, the env section can reference parameter-store keys (including SecureString parameters) and secrets-manager keys (secret-id:json-key:version-stage). CodeBuild resolves them at build time using its service role, which therefore needs ssm:GetParameters or secretsmanager:GetSecretValue and kms:Decrypt on the key.
Choose Secrets Manager when automatic rotation, cross-account sharing through resource policies, or replication to other Regions is required. Choose Parameter Store for configuration values and simple secrets at low or no cost. CloudFormation can resolve both with dynamic references ({{resolve:secretsmanager:...}} and {{resolve:ssm-secure:...}}) so secrets never appear in templates.