How would you rotate a database password used by 12 running services with no downtime?
What they are really testing: Whether you understand that rotation is a rollout problem. The naive single-swap causes an outage, and the fix is the same overlap pattern as a schema change.
A real interview question
How would you rotate a database password used by 12 running services with no downtime?
What most people say
drag me
“Change the password in the database and update the secret, then restart all the services.”
That is an outage. The moment the password changes, every service with the old one starts failing, and the restart window is downtime for all 12 at once with no way to roll back cleanly.
The follow-ups they ask next
A batch job only runs weekly. How does that change the plan?
The old credential must stay valid past at least one full run of the least frequent consumer, so the overlap window is set by the slowest job, not by the fastest service.
How would you avoid static database passwords altogether?
Dynamic credentials from a secrets manager, or cloud IAM database authentication, where the service authenticates with its own identity and receives a short-lived token instead of a shared password.
What the interviewer is listening for
- Creates an overlap window
- Rolls incrementally while watching errors
- Verifies zero usage before revoking
What sinks the answer
- Single in-place swap
- No verification before revoke
- Forgets infrequent consumers
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“A single swap [invalidates every live credential at once, which is an outage]. So [create a second valid credential], [roll services onto it in batches watching errors], [verify the old one has zero usage, allowing for infrequent jobs], then [revoke and automate the cycle].”
Keep going with security
Junior
Your pipeline needs credentials to deploy to production. How do you handle that safely?
Mid
Your vulnerability scanner reports 200 CVEs in a production image. How do you handle it?
Mid
Your deploy role has full administrator access because narrowing it kept breaking things. How do you fix that properly?
Senior
Compliance requires that every production change is approved and auditable. How do you keep deploying daily?
Senior
How would you protect your build pipeline from a supply chain attack?
Mid
Our pipeline takes 45 minutes and developers have stopped waiting for it. How do you fix that?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free