One Environment Per PR — Twelve Months of Real Cost
The decision to spin up an ephemeral environment per PR is *seductive*. Twelve months of measured cost showed *the bill wasn't where the cost lived*.
Last January we decided to spin up an ephemeral environment per PR. Twelve months in, we have the real cost table.
The cloud bill was less than expected. The other costs were more than expected.
Cloud bill — less than expected
Avg env lifetime per PR: 2.4 hrs (between PR open / first commit / merge)
Avg PRs per week: 62
Env-hours per month: ~6,500
EC2 (small): $0.05 / hr × 6,500 = $325
RDS (Aurora serverless): $180
EBS: $90
Network: $40
─────────────────────────────────
Total bill: $635 / mo = $7,620 / yrActual 12-month spend: $8,400. +10% vs plan. Numerically clean.
The cost off-bill
This is where the truth begins.
1. Engineer time lost to boot
Average env boot time 4 min 12 sec per PR. Engineers wait during that. Over a year:
3,224 PRs × 4.2 min = 13,540 min = 225 hours = ~$22,500 (engineer rate)Three times the cloud bill. The single most expensive line.
2. Environments that don't get cleaned up
In theory: auto-deletion on PR merge. In practice: 14% fail to auto-delete for some reason. Quarterly manual cleanup removes about 60 orphaned envs.
Annual orphan cost — about $1,200 (negligible but not zero).
3. Managing DB seed data
Each ephemeral env needs DB seed. We started with an anonymized snapshot of production. Six months in we discovered seed staleness — new schemas added, seed not updated. PRs passed in env, broke production with schema mismatch. Two incidents.
Fix — seed auto-refresh pipeline + seed schema validation tooling. Two-week build. Then quarterly check.
4. Handling external dependencies
How do ephemeral envs connect to external APIs (Stripe, SendGrid, etc.)? Two options:
- Shared sandbox credentials — all envs share one sandbox. Concurrency issues possible.
- Per-env sandbox — call vendor API for new sandbox, hits vendor-side quota.
Our choice: shared sandbox + test-isolation namespace. Not clean, but works.
5. Cleanup monitoring
Auto-cleanup must run without silent failures. Failure → bill grows. We added a cleanup success-rate dashboard. Quarterly check.
Is it worth adopting?
Annual cloud bill: $8,400
Annual engineer boot wait: $22,500
Annual orphan envs: $1,200
Annual extra infrastructure ops: $4,800
────────────────────────────────────
Annual total cost: $36,900
Annual savings (hypothesized):
- Faster PR review: $25,000 (qualitative)
- Fewer regression incidents: $15,000 (estimated)
- Shorter QA cycles: $10,000
─────────────────────────
Annual saving: $50,000Net value about $13,000 / yr. Small but positive.
The real point isn't that the net is positive. It's that engineer boot wait at $22,500 is the largest line — and it can be cut directly by reducing boot time. Drop boot from 4 min to 1 min and annual cost drops by $15,000, raising net value to $28,000.
Four checks before adopting
- Is there an auto-refreshing seed data pipeline?
- Is there an external-dependency sandbox policy?
- Is auto-cleanup failure handling automated?
- Is there an explicit boot-time target (typically under 90 seconds)?
Without these four, every cost line above grows 1.5–2×.
For platform leads evaluating ephemeral environments, the takeaway is simple. If any of these four are missing, build them before adoption — that's what halves the total cost.
Related posts
When a Product Manager Ships Code, Who Owns the Outage?
In organizations where product managers write code with AI and several agents work at once, who checks what before a change reaches production? A role design for verification, approval, and recovery that is independent of the author, grounded in NIST SSDF, SLSA provenance, and the Google SRE postmortem culture.
John Baek
An Eclipse Plugin for the Agent Era — Task Context Was Already the Problem 20 Years Ago
The problem Mylyn set out to solve in the mid-2000s is the agent context problem. What changed is that the thing reading that context is no longer only a person.
Yeongsang Kim
A VS Code Extension for the Agent Era — What Developers Look At Now
Once writing code got cheap, a developer's time moved to judging and approving. Here is why those jobs cannot live outside the editor, and the choices behind the CollabOps VS Code extension.
Seungbaek Lee