Cloud cost prevention and optimization tool.
Project description
Relia
The "ESLint" for Cloud Costs. Prevent cloud waste before it ships to production.
⚡ Problem: The "Bill Shock" Loop
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. They tell you after you've wasted the money.
🛡️ Solution: Shift Left
Relia sits in your Pull Request. It parses your Terraform/Pulumi changes, estimates the monthly cost impact, and blocks the merge if you blow your budget.
Tagline: "Stop paying the infrastructure tax. Start shipping."
🧩 How It Works
Relia runs as a CLI tool in your local environment or CI pipeline to minimize the feedback loop. See ARCHITECTURE.md for details.
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
✨ Features
1. Pre-Deploy Cost Estimation
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 (e.g., "Upgrade gp2 to gp3 for 20% savings").
- Shareable Reports: Generate beautiful HTML dashboards with topology graphs and cost breakdowns for your team.
- Prevent Bill Shock: Catch expensive resources in PRs before they are merged. 👉 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
2. Budget Guardrails
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.00
3. CI/CD Integration
Relia ships with a GitHub Action to block expensive PRs automatically.
🚀 Quick Start
1. Installation
Relia is available via PyPI (and Poetry):
pip install relia
# or
poetry add relia
Generate a shareable HTML dashboard
relia estimate . --format html --out cost-report.html
2. Run Locally
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
3. Run with Docker
You can also run Relia without installing Python:
docker run --rm -v $(pwd):/app relia-io/relia estimate .
Advanced Usage
Handling Complex Variables & Modules
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
Usage Assumptions (S3, Lambda, etc.)
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: 10000
Relia will automatically load this file and apply the usage data (e.g., 500GB of storage) when calculating costs.
4. Use as Pre-Commit Hook
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 exceeded
Maintenance
Updating the Bundled Pricing Database
Relia 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.
5. Add to CI/CD
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'
🗺️ Roadmap
- 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).
🤝 Contributing
We love contributions! Please check out CONTRIBUTING.md to get started.
📄 License
This project is licensed under the Apache 2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file relia_oss-1.1.2.tar.gz.
File metadata
- Download URL: relia_oss-1.1.2.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc7ac4d0c0989f1f3a9b994d836a12d01ac709be424e4f8a669b80795db6bc04
|
|
| MD5 |
435e2c7980980c0d1cb747fc05b3c1b9
|
|
| BLAKE2b-256 |
318a2fe052f449c7daf2f745eda4c6dbbdea529cebeef05c50a3c4c68662e04a
|
Provenance
The following attestation bundles were made for relia_oss-1.1.2.tar.gz:
Publisher:
release.yml on davidahmann/relia_oss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
relia_oss-1.1.2.tar.gz -
Subject digest:
bc7ac4d0c0989f1f3a9b994d836a12d01ac709be424e4f8a669b80795db6bc04 - Sigstore transparency entry: 747204585
- Sigstore integration time:
-
Permalink:
davidahmann/relia_oss@688e5193ae61ef9f9624b71a280256e82823fa68 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/davidahmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@688e5193ae61ef9f9624b71a280256e82823fa68 -
Trigger Event:
push
-
Statement type:
File details
Details for the file relia_oss-1.1.2-py3-none-any.whl.
File metadata
- Download URL: relia_oss-1.1.2-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb3df111cbd8085f777faf51c7144223ca6e0b172d36d4e0a466ee408b5e6331
|
|
| MD5 |
eddb7421336908da447202f391751927
|
|
| BLAKE2b-256 |
e71c69581921b6b7ac2b8c63334d0deb356a4751f76098d7619fa825d419a374
|
Provenance
The following attestation bundles were made for relia_oss-1.1.2-py3-none-any.whl:
Publisher:
release.yml on davidahmann/relia_oss
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
relia_oss-1.1.2-py3-none-any.whl -
Subject digest:
bb3df111cbd8085f777faf51c7144223ca6e0b172d36d4e0a466ee408b5e6331 - Sigstore transparency entry: 747204588
- Sigstore integration time:
-
Permalink:
davidahmann/relia_oss@688e5193ae61ef9f9624b71a280256e82823fa68 -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/davidahmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@688e5193ae61ef9f9624b71a280256e82823fa68 -
Trigger Event:
push
-
Statement type: