Migrate secrets from environment variables in a Git repo to AWS Secrets Manager. How?
BeginnerScenarioMigrations
Answer
Situation read → Two goals: get secrets out of Git, and assume they're compromised because they were in Git.
What I'd do →
- Create the secrets in Secrets Manager (via Terraform with values supplied out of band, or the CLI).
aws secretsmanager create-secret --name prod/api/db --secret-string '{"username":"app","password":"..."}'
- Deliver to apps: External Secrets Operator on Kubernetes syncing into native Secrets, or the Secrets Store CSI driver.
- Grant read access per app with IRSA or Pod Identity, scoped to that app's secret ARNs.
- Rotate every secret that lived in Git; history still contains them.
- Remove from the repo, add gitleaks to pre-commit and CI so they don't come back.
Why → Moving a leaked secret into a vault doesn't un-leak it; rotation is mandatory.
Interview tip → Say "rotate them all" before the interviewer has to ask.
More on Migrations
Migrate an application from EC2 to EKS with zero downtime. Walk me through it.AdvancedMigrate a database from on-prem MySQL to Amazon RDS with minimal downtime. How?AdvancedYou need to move Terraform state from local files to an S3 backend. How?BeginnerMigrate CI from Jenkins to GitHub Actions for 80 repositories. How do you plan it?IntermediateUpgrade an EKS cluster from 1.30 to 1.31 in production. What's your process?IntermediateMove from a monolith to microservices. What's the DevOps side of the migration?Advanced