The "ESLint" for Cloud Costs. Prevent cloud waste before it ships to production.
Features β’ How It Works β’ Quick Start β’ Read the Docs
Every engineering team knows the ritual:
- Engineer deploys a change (e.g., upsizing an RDS instance).
- CI/CD passes (tests pass, build succeeds).
- 30 days later: Finance asks why the AWS bill jumped by $5,000.
Existing tools (CloudHealth, Vantage) are reactive. Unlike traditional cloud cost management tools (like CloudHealth or Vantage) that report on past spending, Relia is a proactive guardrail. It parses your Infrastructure-as-Code (IaC), calculates the monthly cost impact using the AWS Price List API, and enforces budget policies in your Git workflow.
| Requirement | Version | Note |
|---|---|---|
| Python | 3.10+ | Required |
| Terraform | v0.14+ | Core source code |
| OS | Linux, macOS, Win | Cross-platform support |
Relia sits in your Pull Request. It parses your Terraform changes, estimates the monthly cost impact, and blocks the merge if you blow your budget.
Tagline: "Stop paying the infrastructure tax. Start shipping."
Relia runs as a CLI tool in your local environment or CI pipeline to minimize the feedback loop.
flowchart LR
A[Engineer] -->|`git push`| B(Pull Request)
B --> C{Relia CI Check}
subgraph "Relia Engine"
D[Parser] -->|1. Read .tf files| E[Estimator]
E -->|2. Fetch Prices| F[AWS Pricing API]
F -->|3. Calculate Delta| G[Budget Policy]
end
C -->|Run| D
G -->|Over Budget β| H[Block Merge]
G -->|Under Budget β
| I[Allow Merge]
style H fill:#ffcccb,stroke:#ff0000
style I fill:#ccffcc,stroke:#00ff00
Know exactly what a PR will cost before you click merge. Supports EC2, RDS, Lambda, NAT Gateways, and more.
- Active Advisor: Proactively suggests cost optimizations.
- EBS Volumes: Suggests upgrading
gp2togp3(up to 20% cheaper). - EC2 Instances: Recommends modern generations (e.g.,
t2->t3) and Graviton options. - Load Balancers: Identifies potential savings in LCU vs Hourly usage.
- EBS Volumes: Suggests upgrading
- Prevent Bill Shock: Catch expensive resources in PRs before they are merged.
Generate a premium, self-contained HTML dashboard for your team or finance department. This report includes:
- Infrastructure Topology Graph (Mermaid.js)
- Interactive Cost Table (Sort & Filter)
- Optimization Tips
# Generate report.html
relia estimate . --format html --out report.htmlπ See Full List of Supported Resources
Supports both standard .tf files and terraform plan -json output:
# Standard Estimate
$ relia estimate
π Relia Cost Estimate ...# View as JSON for pipeline parsing
relia estimate . --format json | jq .total_costπ Relia Cost Estimate ...
# With Visual Topology
$ relia estimate --topology
π³ Infrastructure Topology
βοΈ Project
βββ aws_instance
βββ π» web $60.00/mo
# With Cost Diff
$ relia estimate --diff
π Cost Diff
+ aws_instance.web +$60.00/mo
Set clear policies in .relia.yaml and enforce them with relia check.
# .relia.yaml
budget: 500.0
rules:
aws_instance: 50.0 # Max price per instance$ relia check --budget 500
β
Within budget. Total: $450.00, Limit: $500.00Relia ships with a GitHub Action to block expensive PRs automatically.
Relia is available via PyPI (and Poetry):
pip install relia
# or
poetry add reliarelia estimate . --format html --out cost-report.html
Navigate to your Terraform project and run:
-
Initialize Config (Optional):
relia init # Creates .relia.yaml (budget/rules) & .relia.usage.yaml (usage overlay) -
Estimate Cost:
relia estimate . -
Check Budget:
relia check . --budget 1000 # Or using config rules: relia check . # Simulate check (exit 0 even if failure): relia check . --dry-run
You can also run Relia without installing Python:
docker run --rm -v $(pwd):/app relia-io/relia estimate .For complex projects using variables, locals, or modules, Relia supports Terraform Plan JSON output.
- Generate the plan JSON:
terraform plan -out=tfplan terraform show -json tfplan > plan.json - Estimate costs using the JSON plan:
relia estimate plan.json
Some resources (like S3 or Lambda) depend on usage metrics not present in Terraform. You can define these in .relia.usage.yaml:
Example .relia.usage.yaml:
usage:
aws_s3_bucket.my_bucket:
storage_gb: 500
monthly_requests: 10000Relia will automatically load this file and apply the usage data (e.g., 500GB of storage) when calculating costs.
Prevent bad commits locally by adding Relia to your .pre-commit-config.yaml:
repos:
- repo: https://github.com/davidahmann/relia_oss
rev: v1.1.1
hooks:
- id: relia-estimate # Prints cost table on every commit
- id: relia-check # Blocks commit if budget exceededRelia ships with a lightweight, bundled pricing database (SQLite) for offline usage. To update this database with new mocked values or seed data:
- Ensure you have AWS credentials configured.
- Run the script to fetch fresh prices from AWS (US/EU regions):
python scripts/seed_pricing.py
- Commit the updated
relia/core/bundled_pricing.db.
Add Relia to your GitHub Actions workflow to block expensive PRs.
# .github/workflows/cost-check.yml
name: Cost Check
on: [pull_request]
jobs:
relia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: relia-io/action@v1
with:
path: './infra'
budget: '1000'
markdown_report: 'relia_report.md'- Phase 1 (MVP): CLI, Terraform Support, AWS Pricing.
- Phase 2: GitHub Action, Budget Policies via
.relia.yml. - Phase 3 (v0.3.0): Lambda/NAT/LB Support, Usage Overlays.
- Phase 4: Utilization Scanning ("Fix" Mode).
We love contributions! Please check out CONTRIBUTING.md to get started.
This project is licensed under the Apache 2.0 License.