comparisoninfracostterraformcost-estimation

Infracost Alternative: Open Source Cloud Cost Estimation Without a SaaS

Honest comparison of C3X vs Infracost for Terraform cost estimation. Where each tool wins, full feature matrix, and a migration guide for teams switching off Infracost.

The C3X Team··10 min read

Three weeks after a quiet Terraform pull request landed, the AWS bill showed a $400 surprise. A teammate had bumped an EC2 instance from m5.xlarge to m6i.8xlarge as part of a performance fix, the PR was approved, the apply ran cleanly, and the cost moved in lockstep with the change. Nobody on the review noticed, because nobody looks at AWS pricing pages during code review.

That story is not unusual. The decision to provision an expensive resource almost always happens in a pull request, not in a FinOps meeting. By the time the monthly cost review surfaces the regression, the change is already in production and rolling it back is paperwork.

The fix is to put cost numbers where the code review happens. Show the delta on the PR. Block the merge if it exceeds a budget. Make cost a first-class output of the IaC review process, the same way we treat security scans, lint, and tests.

For a long time, the answer to this problem in the Terraform world was Infracost. It worked, it was open source, and it shifted cost visibility left into the PR. But the product has moved toward a SaaS-first model with API keys, paid recommendations, and paid CloudFormation support. For teams that need open source, self-hostable, and free for all features, the landscape needed something new.

We built C3X for that gap. Apache 2.0, no API key required for the public pricing endpoint, fully offline mode, free cost recommendations, free CloudFormation support, and a self-hostable pricing API that scrapes directly from AWS, Azure, and GCP. This post is an honest comparison: where C3X wins, where Infracost still wins, and how to migrate if that fits your team.

Why Infracost was the standard answer for years

Infracost did real engineering work. It built the first widely adopted Terraform-native cost estimator, popularized the "cost diff in PR comment" pattern, and pushed FinOps left into the development workflow. The CLI was good, the GitHub Action was easy to set up, and the community contributed resource definitions for hundreds of AWS services.

Over time, the product evolved toward a SaaS-first model. The CLI still works without a paid plan, but several capabilities require either an API key tied to an Infracost account or a paid Cloud tier:

  • The default pricing endpoint requires an API key. Anonymous usage is not supported, even for hobby projects.
  • Cost recommendations (the part that tells you what to do about a high-cost resource) are gated behind paid plans.
  • CloudFormation support is part of the paid Cloud product, not the open source CLI.
  • The self-hostable pricing API (cloud-pricing-api) is open source, but the team has deprioritized it in favor of the hosted SaaS. Pricing data updates and feature parity lag.
  • PR comment branding (logo, bot identity) is tied to the Cloud product.

None of this is wrong. Building a sustainable open source business is hard, and a SaaS tier is a legitimate path. But it leaves room for an alternative that keeps the entire stack open source, free, and self-hostable without a feature gate.

What we built differently with C3X

C3X is designed around a single principle: cost estimation is infrastructure, not a SaaS product. That principle drives every product decision:

  • No API key for the public endpoint. The pricing API at pricing.c3x.dev is free and anonymous. Install the CLI, point at your project, see your cost. No account, no email capture.
  • Self-hostable in one docker-compose. The pricing API ships as a single image backed by PostgreSQL. It scrapes directly from the AWS bulk pricing feed, the Azure Retail Prices API, and the GCP Cloud Billing Catalog. Stand it up on a $5 VPS in ten minutes.
  • Free cost recommendations. c3x recommend suggests newer instance generations (m5 → m7i), storage migrations (gp2 → gp3), and architecture changes (VPC endpoints to avoid NAT Gateway charges). No paid tier.
  • Free CloudFormation support. C3X parses .yaml and .json templates the same way it parses Terraform.
  • Fully offline mode. c3x pricing sync downloads the pricing dataset locally. From then on, estimates run with zero network calls. Suitable for air-gapped environments and high-compliance teams.
  • Apache 2.0, single binary. No SaaS account, no telemetry by default, no rug-pull risk.

On the CI side, the GitHub Action is a two-line YAML block:

- uses: c3xdev/setup-c3x@v1
  with:
    path: .

That action installs the binary, estimates the base branch, diffs against the PR branch, and posts a cost-diff comment back to the PR. Comments can show up branded as "C3X" via the optional GitHub App, or unbranded via the default GITHUB_TOKEN.

Feature-by-feature comparison: C3X vs Infracost

Below is the comparison as we read it today. The data is checked against publicly available Infracost documentation. If you spot an error, file an issue.

FeatureC3XInfracost
Open source CLIYesYes
No API key requiredYesNo
Fully offline modeYesNo
Self-hosted pricing APIFreePaid (Cloud)
Cost recommendationsFreePaid
CloudFormation supportFreePaid
What-if scenarios--what-if flagNo
Budget guardrails--budget flagOPA/Rego
AWS resources700+700+
Azure resources300+300+
GCP resources100+100+
Terragrunt supportYesYes
Enterprise supportContact usPackaged tier

Where Infracost has more today

Honesty matters here. Infracost has been around longer and has a larger active user base. A few areas where the gap is real:

  • Larger ecosystem. More blog posts, more StackOverflow answers, more community resource definitions.
  • Mature OPA/Rego policy integration. If your team already runs Open Policy Agent for governance, Infracost has the deeper out-of-the-box integration today.
  • Cross-repo cost dashboards. Infracost Cloud aggregates costs across repos with dashboards and historical charts. C3X has this on the v2 roadmap.

When to choose which

Choose C3X if you want an open-source-first FinOps stack with no vendor lock-in: free for every feature, no API key, a self-hostable pricing API at zero cost, fully offline mode, and free CloudFormation support. Most teams that want to own their tooling end up here.

Choose Infracost if you need cross-repo cost dashboards in production today, you have an existing OPA/Rego policy library you don't want to port, or your team has already standardized on it and the switching cost outweighs the savings.

For larger rollouts or enterprise needs, both projects are viable. We work directly with early enterprise users of C3X to shape support, SSO, and procurement options. If that is your context, reach out.

Migrating from Infracost to C3X

If you decide to switch, the migration is mostly mechanical. The commands map cleanly:

InfracostC3X
infracost breakdown --path .c3x estimate --path .
infracost diff --path . --compare-to base.jsonc3x diff --path . --compare-to base.json
infracost comment githubc3x comment github
infracost configure set api_key …Not required

Migrating the CI workflow

The most common pattern is the GitHub Action. Swap the Infracost action for the C3X setup action. Here is a representative before/after.

Before (Infracost):

- uses: infracost/actions/setup@v3
  with:
    api-key: ${{ secrets.INFRACOST_API_KEY }}

- run: infracost breakdown --path=. --format=json --out-file=/tmp/infracost.json
- run: infracost comment github --path=/tmp/infracost.json --repo=${{ github.repository }} --pull-request=${{ github.event.pull_request.number }} --github-token=${{ secrets.GITHUB_TOKEN }}

After (C3X):

- uses: c3xdev/setup-c3x@v1
  with:
    path: .

Two lines. The C3X setup action installs the binary, estimates the base branch, diffs the PR branch, and posts the comment. There is no secret to configure for the default unbranded comment. If you want branded comments, install the C3X Cloud GitHub App on your repo. Also free.

Migrating the self-hosted pricing API

If you were running Infracost cloud-pricing-api on your own infra, swap it for c3xdev/c3x-pricing-api. It is a single docker-compose file backed by PostgreSQL, scrapes AWS bulk pricing, Azure Retail Prices, and GCP Cloud Billing Catalog on a daily cron. Documentation is in the self-hosted docs.

Caveats to know before you switch

  • Bicep and ARM are on the roadmap, not shipped. If your IaC is Azure Bicep today, C3X will not parse it. Terraform on Azure works fully.
  • OPA/Rego policies do not port directly. If you have a large Rego policy library, you will need to translate policies to --budget flags or custom CI gates.
  • No cross-repo aggregation yet. If you currently use Infracost Cloud to see costs across many repos at once, that feature lands in C3X v2.

Getting started with C3X

Install:

brew install c3xdev/tap/c3x

First estimate:

c3x estimate --path /path/to/terraform

For the full setup including CI integration and budget guardrails, see the quickstart guide. For the GitHub Action setup, see the CI/CD docs. For self-hosting the pricing API, see the self-hosted docs.

FAQ

Can I use C3X in production?

Yes. The CLI is Apache 2.0, the public pricing API is running on production infrastructure with 24/7 monitoring, and we publish a /status endpoint showing data freshness per cloud provider.

Is the public pricing API rate-limited?

Yes, lightly. The current limit is generous enough for normal CI usage and individual developer workflows. If you hit limits at scale, self-host the pricing API. It is one docker-compose command.

How accurate is C3X compared to Infracost?

Both tools use the same upstream sources: AWS bulk pricing, Azure Retail Prices, GCP Cloud Billing Catalog. The price data should match. Differences come from resource model coverage (which attributes are mapped to which pricing dimensions) and usage assumptions for resources that price on usage (Lambda, S3, data transfer). C3X uses usage files for this, similar to Infracost.

Do I need to migrate everything at once?

No. The two tools can coexist in the same repo. Run them side by side for a few weeks and compare outputs. Migrate the CI step when you are confident.

Closing

C3X is open source, free, and on GitHub. If you try it and find a gap or a bug, file an issue. If it works for you, a star helps other teams find it. And if you have feedback on how cost estimation should work in your workflow, the Slack community is where that conversation happens.

Try C3X on your own Terraform

Free and open source. No API key required. One command to install, one command to estimate.