Ephemeral preview environments were a success. The cloud bill has tripled. What went wrong?
Show the full answer Hide the answer
What the interviewer is testing
Whether you anticipated the operational economics of a pattern you advocated.
The likely causes
Environments are not being destroyed. A pull request closed without triggering teardown, a failed cleanup job, an environment created outside the normal flow. Leaked environments accumulate silently and forever, and this is the largest cause by a wide margin.
No scale-to-zero. Environments run continuously when they are used for perhaps twenty minutes a day.
Full-fidelity everything. Each environment provisions production-sized databases, managed services with a minimum billing unit, and every service in the estate rather than the ones under change.
Managed service minimums. Some services bill a floor regardless of usage; forty environments each with one is a fixed cost that dwarfs the compute.
The fixes
A hard TTL with automatic destruction, independent of the pull request lifecycle. Not "destroy on merge" — "destroy after N hours unless renewed". That single change fixes leakage permanently because it does not depend on any event firing correctly.
Scale to zero on idle, with wake-on-request.
Provision only what changed, binding the rest to a shared dependency tier or virtualised contracts.
Shared infrastructure for expensive components — one database server with a schema per environment rather than a managed instance each.
Cost visibility per environment, attributed to the team, published.
What a strong answer adds
Recognising that the pattern is still correct — the alternative was a contended, drifted staging environment — so the answer is to fix the economics, not to revert. Preview environments that cost more than the staging tier they replaced are still often worth it, but that should be a measured statement rather than an assumption.
And a guardrail: a quota on concurrent environments per team, so a runaway automation cannot create four hundred.
Common weak answers
Reverting to shared staging. Reducing environment fidelity to the point where they prove nothing.