Terraform cost estimation before you apply
Practical experience with Infracost and similar tools, their limits, and how to fold the estimate into the team’s PR and review process.
Applying Terraform without a cost estimate is like merging a PR without tests. The change may be correct and still be expensive. Tools such as Infracost (and the provider-native estimators) turn the plan into a dollar delta before the apply happens.
I run the estimate on every PR that touches infrastructure and require a human acknowledgement when the monthly delta exceeds a threshold (for us, $50 or 10 %, whichever is larger). The estimate is not perfect—usage-based costs such as data transfer and request volume are only as good as the assumptions—but it catches the large, obvious mistakes: an accidentally large instance type, a multi-AZ database that was meant to be single-AZ, a snapshot policy with “keep forever.”
What the tools are good at
- Resource prices that are fixed or have clear monthly units (instances, volumes, load balancers, fixed gateway hours)
- Showing the delta between the current state and the planned state
- Breaking the cost down by resource so the expensive lines are obvious
What they cannot see
- Actual data-transfer volume
- Request rates that drive serverless or API costs
- Spot interruption behaviour and real realised prices
- Reserved Instance / Savings Plan discounts that depend on coverage
For those I still rely on the post-apply bill review and the Egress / Serverless calculators with measured numbers.
Folding it into the workflow
# Typical CI step
infracost breakdown --path . --format json --out-file infracost.json
infracost comment github --path infracost.json ... # posts a comment on the PR
The PR comment becomes the starting point of the review conversation. If the delta is large, the author either justifies it or changes the code before merge.
Cost estimation before apply does not replace the monthly bill review. It prevents the most expensive surprises from ever reaching the bill in the first place.

I also keep a short allow-list of resource types that are known to be usage-heavy (NAT gateways, high-volume log groups, large data-transfer paths). For those the estimate is treated as a lower bound and the author is asked to supply a rough monthly usage assumption. The combination of automated fixed-cost estimation and explicit usage assumptions has removed the majority of “we didn’t realise it would cost that much” conversations.
Related tools
-
Small Cloud VM Cost Calculator
Compare small Linux VMs on AWS T3, Azure B-series, Google E2, and DigitalOcean Droplets, including transfer.
-
Object Storage Cost Calculator
Break down storage, requests, retrieval, and egress for S3, Blob, GCS, and R2.
-
Serverless API Cost Calculator
Estimate request and compute cost for Lambda, Functions, Cloud Run, and Workers.
Related reading
-
Using tags and cost allocation from day one A practical tag strategy, enforcement mechanisms and the pain of trying to retrofit cost allocation after the fact. -
Monthly cloud bill review ritual for a small team A fixed 30-minute process, the five numbers that matter, and an action-item template that turns cost review from a vague intention into a repeatable habit.