Cloud Economics
How to Estimate Infrastructure Cost Before Deployment
To estimate infrastructure cost before deployment, price the current and proposed configurations for the same environment using the same billing period and currency. Subtract the baseline estimate from the proposed estimate. In the pull request, report that monthly difference under expected and higher usage, list the quantities behind both estimates, and flag charges you could not price.
Use Infracost to estimate Terraform changes, including from plan JSON, and AWS Pricing Calculator to model AWS services and usage assumptions. Infracost’s usage-cost documentation explains how to supply monthly quantities for usage-based charges.
Define the change under review
Set the baseline as the configuration the team would run if it declined the pull request. Set the proposal as the configuration it would run if it merged. Use the same environment, billing period, currency, and pricing basis for both estimates. If the proposal changes the Region or purchase option, record that explicitly. This helps reviewers separate architectural differences from differences caused by assumptions.
List the resources the proposal adds, removes, or reconfigures. For each resource, record the attributes needed to identify its price and the quantities needed to estimate the charge. Infracost says it parses infrastructure-as-code projects locally to determine resource types and quantities. Its documentation describes estimating from Terraform plan JSON produced by terraform show -json as useful for costs that only resolve at plan time.
Subtract the baseline estimate from the proposed estimate to calculate the monthly delta. Show both totals and the line items behind the difference. To isolate an architecture change, use the same workload in both estimates. If traffic growth is part of the decision, show it as a separate scenario so reviewers can compare both architectures under the same demand.
Match the tool to the inputs
| What you have | Tool | What to bring to the review |
|---|---|---|
| A Terraform change with resource attributes that resolve during planning | Infracost can estimate from Terraform plan JSON, and its CI/CD integration can post a cost diff in the pull request. Infracost documentation | The monthly delta and the resources driving it. |
| An AWS design with service and workload assumptions | AWS Pricing Calculator models the services and inputs you enter, shows the underlying calculations, and lets you save an estimate link. AWS Pricing Calculator user guide | A shareable estimate with the entered quantities and payment options. |
| An internal estimator that needs AWS catalog prices | The AWS Price List documentation says the Query API returns SKU-level prices by product attribute and the Bulk API provides JSON and CSV price lists organized by service and Region. | The selected SKU or price list, its billing unit, and the lookup date. |
If the decision is still about which provider or plan to evaluate, start with the cloud comparison tool and bring the selected configuration into the deployment estimate. For review evidence, keep the pricing lookup date separate from the date you ran the estimate. See pricing snapshot dates and evidence dates.
Model usage the plan cannot determine
The Infracost usage-cost documentation distinguishes baseline costs, such as the hourly charge for a provisioned virtual machine, from usage costs, such as the storage cost for an object storage bucket. Infracost assumes a 730-hour month for baseline resources and marks usage costs with an asterisk. Check the runtime assumption when the proposal includes capacity you plan to run on a schedule.
For each usage-based charge, record the monthly quantity, billing unit, and source of the assumption. Use measurements from the current workload when available. For a new service, base the estimate on a launch assumption the team can review, such as expected stored data or monthly writes. Give the higher-usage scenario a concrete trigger, such as retaining more data than planned, so reviewers can see what would change the estimate.
Infracost says it accepts monthly usage inputs from Infracost Cloud or a repository’s infracost-usage.yml and gives repository values precedence when they overlap. Its documentation says predefined values aim for about $5 per month per usage-based cost in common configurations. When those values are disabled in Infracost Cloud, Infracost says pull request comments omit costs for usage keys without overrides, which can make those resources look free. Flag defaulted and unpriced lines so reviewers can tell them apart from modeled charges.
For estimates built in AWS Pricing Calculator, check that the service list and quantities cover the architecture under review. The AWS Pricing Calculator user guide says estimates cover only the information entered, exclude taxes, and use prices from the AWS Price List API. If you build an estimator using the AWS Price List APIs, AWS says the catalog excludes Amazon EC2 Spot Instances and time-limited Free Tier offers, and the Query API does not support Savings Plans prices. The AWS Price List documentation also says that AWS charges the price on the service pricing page if it differs from the price list file.
If the proposal includes rented accelerators, use the GPU rental hidden costs guide to check for charges to model alongside the rental.
Work through a Terraform pull request
Consider an illustrative Terraform pull request that adds an always-on virtual machine and changes a service to retain more data in an existing Amazon DynamoDB table. The team expects the same write workload after the change. Infracost’s documentation uses storage_gb and monthly_write_request_units as DynamoDB usage inputs. Infracost usage-cost documentation
| Input | Baseline | Proposal |
|---|---|---|
| Added virtual machine | Absent | Use the proposed instance type and AWS Region and assume a 730-hour month. |
DynamoDB storage (storage_gb) | 50 GB | 1,000 GB under the illustrative longer retention policy. |
DynamoDB writes (monthly_write_request_units) | 200 write request units per month | Same as baseline. |
Price both configurations, then show how much of the modeled delta comes from the virtual machine and how much comes from the revised storage estimate. Repeat the comparison using higher stored-data assumptions for both retention policies. Keep the same catalog price basis across both scenarios so the difference reflects the storage assumption. If the team has not estimated how much data the new retention policy will hold, report the priced virtual machine separately and mark the storage delta as unresolved.
Put the estimate in the pull request
In their February 8, 2021 Launch HN post, Infracost’s founders introduced an open-source Terraform cost estimator that posted a proposed change’s cost impact in the pull request. In an August 13, 2024 Show HN post, Owen from Infracost introduced a JetBrains plugin that showed cost estimates as engineers wrote code. In the discussion, he said usage estimates at the time relied on a usage file.
Place the expected monthly delta near the top of the pull request comment. Follow it with the higher-usage result, the largest changed line items, and the inputs or exclusions that could affect the decision. Link the underlying estimate and name who supplied the workload assumptions. If the estimate leads the team to reconsider the design, the line items can show where to start.
Update the comparison when the proposed configuration or usage assumptions change. After deployment, compare the modeled quantities with observed quantities for the same scope and billing period. Record any differences so the next pull request can use a better workload assumption.
Sources
- Launch HN: Infracost (YC W21), open-source cloud cost estimator (Infracost founders on Hacker News, 2021-02-08)
- Show HN: See the impact on your cloud costs as you code (Infracost on Hacker News, 2024-08-13)
- Get started (Infracost, accessed 2026-11-30)
- Usage costs (Infracost, accessed 2026-11-30)
- Calling AWS services and prices using the AWS Price List (Amazon Web Services, accessed 2026-11-30)
- What is AWS Pricing Calculator? (Amazon Web Services, accessed 2026-11-30)
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
How to Estimate Infrastructure Cost Before Deployment. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/estimate-infrastructure-cost-before-deployment/