Skill 6.1.3
Automating credential rotation for machine identities (for example, AWS Secrets Manager)
Key Concepts
Prefer credentials that do not need rotating: IAM roles for EC2, ECS, Lambda and EKS give temporary credentials automatically, and IAM Roles Anywhere issues temporary credentials to on-premises workloads with X.509 certificates.
For database passwords and API keys, Secrets Manager rotation uses a Lambda function on a schedule (AWS provides rotation functions for RDS, Aurora, Redshift and DocumentDB, and managed rotation needs no function at all for service-managed secrets). The single-user strategy changes one user's password; the alternating users strategy rotates between two users to avoid connection errors during rotation. The rotation function needs network access to the database and to the Secrets Manager endpoint.