An auditor asks how often you rotate database credentials. You currently never do. What do you build?
IntermediateScenarioSecrets and Identity Management
Answer
Situation read → Manual rotation never happens. It has to be automated and the app has to tolerate it.
What I'd do →
- Turn on managed rotation:
aws secretsmanager rotate-secret --secret-id prod/orders/db --rotation-rules AutomaticallyAfterDays=30, or RDS-managed master passwords. - Use the alternating-users strategy so one credential is always valid during the switch.
- Make the app re-read the secret on auth failure or on a short cache TTL instead of only at startup.
- Alert on rotation failures through EventBridge or CloudWatch.
- Longer term, move to Vault dynamic credentials so each pod gets its own short-lived user.
Why → Rotation that breaks the app gets disabled within a week, so app behaviour matters as much as the schedule.
Interview tip → Say "rotation is an app-design problem, not a cron job".
More on Secrets and Identity Management
A team stores database passwords in a `.env` file committed to a private repo. How do you migrate them out?BeginnerYour CI pipeline uses long-lived AWS access keys stored as repository secrets. How do you replace them?IntermediatePods need AWS access. A developer mounted an IAM user's keys as a Kubernetes Secret. What do you propose instead?BeginnerShould you use Kubernetes Secrets, Sealed Secrets, External Secrets Operator or the Secrets Store CSI driver?IntermediateA Slack webhook URL and a Stripe live key were posted in a public GitHub issue. What is your response sequence?BeginnerHow would you set up HashiCorp Vault so Kubernetes workloads authenticate without any static token?Advanced