Interview Prep/DevSecOps/Secrets Management Architecture

How does AWS Secrets Manager rotation work under the hood?

IntermediateProductionSecrets Management Architecture
Answer

A rotation Lambda runs four steps, moving staging labels between versions:

  1. createSecret: generate a new value as AWSPENDING.
  2. setSecret: apply it to the target (DB user password).
  3. testSecret: log in with the pending value.
  4. finishSecret: move AWSCURRENT to the new version; the old becomes AWSPREVIOUS.
aws secretsmanager rotate-secret --secret-id prod/orders/db \
  --rotation-rules '{"ScheduleExpression":"rate(30 days)"}'

For RDS, prefer --manage-master-user-password, which lets RDS and Secrets Manager handle the master password rotation without a custom Lambda.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets Management Architecture