How do you make sure production secrets never end up in dev or in someone's laptop?
BeginnerScenarioMulti-env and multi-account
Answer
Situation read → Separate secrets by environment at the storage and access level, so the dev identity simply can't read prod values.
What I'd do →
- Store secrets per account: prod secrets live only in the prod account's Secrets Manager.
- Access via workload identity (IRSA, Pod Identity) scoped to specific secret ARNs; humans don't have read access by default.
- Use different values per environment; never copy prod passwords to staging "to make it work".
- Block secrets from Git with pre-commit scanning (gitleaks) and GitHub push protection.
- Alert on reads of prod secrets by human principals (CloudTrail
GetSecretValue).
Why → Account and IAM boundaries enforce separation; conventions alone don't.
Interview tip → Mention push protection; it blocks the commit before it ever reaches the remote.
More on Multi-env and multi-account
Design the AWS account structure for a 50-engineer startup that's growing fast.IntermediateHow do you promote the same build from dev to staging to prod?BeginnerBugs keep passing staging and appearing in production. How do you make staging closer to prod?IntermediateHow do you structure Terraform for dev, staging and prod? Workspaces, directories or Terragrunt?IntermediateDevelopers want a preview environment for every pull request. How would you build it?AdvancedHelm values files or Kustomize overlays for per-environment config?Beginner