Quick Start
Get up and running with C3X in under five minutes. This guide walks you through installation, your first cost estimate, budget guards, what-if analysis, and CI/CD integration.
1. Install C3X
Choose the installation method that works best for your environment.
Homebrew (macOS / Linux)
brew install c3xdev/tap/c3xDocker
docker pull c3xdev/c3x:latest
# Run directly
docker run --rm -v $(pwd):/workspace c3xdev/c3x:latest \
estimate --path /workspaceBinary Download (curl)
# Linux (amd64)
curl -fsSL https://github.com/c3xdev/c3x/releases/latest/download/c3x-linux-amd64.tar.gz | \
tar -xz -C /usr/local/bin c3x
# macOS (arm64)
curl -fsSL https://github.com/c3xdev/c3x/releases/latest/download/c3x-darwin-arm64.tar.gz | \
tar -xz -C /usr/local/bin c3x
# Verify installation
c3x --version2. Run Your First Estimate
Point C3X at any directory containing Terraform files. It will automatically parse your configuration, resolve modules, and calculate costs.
c3x estimate --path /path/to/terraformC3X outputs a table showing each resource, its monthly cost, and the total. Use --format json or --format html for machine-readable or shareable output.
3. Get Recommendations
C3X can analyze your infrastructure and suggest cost optimizations such as right-sizing instances, switching to reserved pricing, or removing unused resources.
c3x recommend --path .Each recommendation includes an estimated monthly saving and a brief explanation of the change.
4. Set a Budget Guard
Fail the command with a non-zero exit code when the estimated monthly cost exceeds a threshold. This is especially useful in CI/CD pipelines.
c3x estimate --path . --budget 1000If the estimate exceeds $1,000/month, C3X exits with code 1 and prints a warning. You can also use --budget-increase to gate on the change in cost rather than the absolute total.
5. Try What-If Analysis
Explore cost impacts of infrastructure changes without modifying your Terraform files.
c3x estimate --path . --what-if 'aws_instance.web.instance_type=m6i.xlarge'You can pass multiple --what-if flags to simulate several changes at once. C3X recalculates the full estimate with your overrides applied.
6. Add to CI
Integrate C3X into your pull request workflow so every change gets a cost estimate automatically. Here is a complete GitHub Actions workflow.
name: Cost Estimation
on: [pull_request]
permissions:
pull-requests: write
contents: read
jobs:
c3x:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: c3xdev/setup-c3x@v1
with:
path: .Two steps. No API key, no secrets. Every PR gets a cost estimate comment automatically. Install the C3X Cloud app for branded comments with the C3X logo. See the CI/CD Integration guide for GitLab, Bitbucket, Azure Pipelines, Atlantis, and Spacelift examples.
Try the Examples
The C3X repository includes ready-to-run examples for Terraform, Terragrunt, and CloudFormation. Clone and try them:
git clone https://github.com/c3xdev/c3x.git
cd c3x/examples/terraform
c3x estimate --path .Available examples:
- examples/terraform/: EC2 instance + Lambda with usage file. Try changing the instance type or region to see cost differences.
- examples/terragrunt/: Multi-environment Terragrunt setup (dev + prod) with shared modules.
- examples/cloudformation/: AWS CloudFormation template with usage-based resources.
To estimate with usage data (for Lambda, S3, etc.):
c3x estimate --path examples/terraform --usage-file examples/terraform/c3x-usage.ymlNext Steps
- CLI Reference: Explore every command and flag.
- Usage File Format: Model variable-cost resources like Lambda invocations and S3 storage.
- Self-Hosted & Offline: Run C3X without any external network calls.