Multi-cloud FinOps CLI tool for comprehensive cost analysis and infrastructure optimization across AWS, GCP, Azure, Alibaba Cloud, and Oracle Cloud
npm install infra-costMulti-cloud FinOps CLI tool for comprehensive cost analysis and infrastructure optimization





Take control of your cloud costs across AWS, Google Cloud, Azure, Alibaba Cloud, and Oracle Cloud ๐
Installation โข Quick Start โข Features โข Documentation โข Development โข Contributing
---
> ๐ข Migrating from v0.x?
> infra-cost v1.0 introduces a new subcommand-based CLI architecture for better organization and discoverability.
>
> - Quick migration: Run infra-cost config migrate to automatically update your configuration
> - Command changes: Old flags are now organized subcommands (e.g., --inventory โ export inventory json)
> - Full guide: See MIGRATION_GUIDE.md for complete migration instructions
>
> All new features and improvements are built on this solid foundation!
---
Save money. Optimize resources. Make informed decisions.
- ๐ธ Reduce cloud spend by up to 30% with actionable insights
- ๐ Multi-cloud visibility - see costs across all your providers in one place
- โก Real-time analysis - get instant cost breakdowns and trends
- ๐ค AI-powered recommendations for optimization opportunities
- ๐ Executive reports - beautiful PDF reports for stakeholders
- ๐ Smart alerting - proactive cost anomaly detection
- ๐ฌ Team collaboration - Slack integration for cost awareness
infra-cost v1.0 uses a modern subcommand-based architecture for better organization and discoverability.
#### infra-cost now - Instant Cost Check (NEW in v1.2.0)
See today's cloud spending in one second - perfect for morning cost checks!
``bashQuick daily cost check (zero config)
infra-cost now
for detailed breakdownFeatures:
- ๐ Zero configuration - auto-detects your default AWS profile
- ๐ Smart summary - today's cost + delta from yesterday
- ๐ฏ Top 3 services - see where your money is going at a glance
- ๐น Budget progress - visual progress bar if budgets configured
- ๐จ Color-coded - green = under budget, red = over budget
- โก Lightning fast - get your answer in ~1 second
Options:
`bash
infra-cost now # Default profile
infra-cost now --profile prod # Specific profile
infra-cost now --provider gcp # Google Cloud
infra-cost now --json # JSON output for scripting
`Perfect for:
- Morning stand-ups: "How much did we spend yesterday?"
- Quick sanity checks before demos
- Solo developers and indie hackers
- Anyone who wants instant cost visibility
---
####
infra-cost free-tier - AWS Free Tier Tracker (NEW in v1.2.0)Track your AWS Free Tier usage and prevent surprise bills - perfect for solo developers and indie hackers!
`bash
Check free tier status
infra-cost free-tierOutput:
๐ AWS Free Tier Status (Account: 123456789012)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
#
EC2 (t2.micro/t3.micro instances)
โโโ Used: 620.0 hours / 750 hours (82.7%)
โโโ [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 83%
โโโ โ ๏ธ Warning: 130.0 hours remaining
#
S3 (Standard storage)
โโโ Used: 4.2 GB / 5 GB (84.0%)
โโโ [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 84%
โโโ โ ๏ธ Warning: 0.8 GB remaining
#
Lambda (1M requests, 400K GB-sec)
โโโ Used: 0.0 cost / 0 cost (0.0%)
โโโ [โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ] 0%
โโโ โ
On track
#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ก Tip: You have 8 days until month end
`Features:
- ๐ Tracks popular free tier services: EC2, S3, Lambda, RDS
- ๐ Visual progress bars - see usage at a glance
- โก Smart alerts - warns when approaching limits (default: 80%)
- ๐ฐ Cost projection - estimate month-end overages
- ๐ฏ Perfect for beginners - avoid surprise AWS bills
- ๐จ Status indicators - green=safe, yellow=warning, red=critical
Options:
`bash
infra-cost free-tier # Check current status
infra-cost free-tier --alert-threshold 90 # Custom threshold
infra-cost free-tier --show-projection # Show projected overages
infra-cost free-tier --json # JSON output
`Tracked Services:
- EC2: 750 hours/month (t2.micro/t3.micro)
- S3: 5 GB storage
- Lambda: Cost-based tracking (free tier = $0 cost)
Perfect for:
- Solo developers and indie hackers
- Students learning AWS
- New AWS users avoiding surprise bills
- Monthly free tier checkups
---
####
infra-cost annotate - Cost Annotations for IaC Files (NEW in v1.3.0)Add cost estimates directly in your Infrastructure as Code files - see costs during code review!
`bash
Annotate Terraform files
infra-cost annotate --path ./terraform/Before:
resource "aws_instance" "web" {
instance_type = "t3.xlarge"
ami = "ami-12345678"
}After:
๐ฐ infra-cost: $121.47/month | aws_instance @ us-east-1
๐ก Consider t3.large for 50% savings if CPU < 40% (saves $60.74/month)
๐ Last updated: 2026-01-30
resource "aws_instance" "web" {
instance_type = "t3.xlarge"
ami = "ami-12345678"
}
`Features:
- ๐ Terraform & CloudFormation support - HCL and YAML annotations
- ๐ฐ Monthly cost estimates - see the cost of each resource
- ๐ก Optimization suggestions - inline recommendations for savings
- ๐ Auto-update - keep annotations fresh with --update flag
- ๐งน Clean removal - remove all annotations with --remove
- ๐ Dry run - preview changes before applying
Commands:
`bash
Annotate all Terraform files in a directory
infra-cost annotate --path ./terraform/CloudFormation templates
infra-cost annotate --path ./cloudformation/ --format cloudformationPreview without modifying files
infra-cost annotate --path ./terraform/ --dry-runUpdate existing annotations
infra-cost annotate --path ./terraform/ --updateRemove all cost annotations
infra-cost annotate --path ./terraform/ --remove
`Perfect for:
- Code reviews with cost visibility
- DevOps engineers writing IaC
- Cost-aware development culture
- Pre-commit cost checks
- Documentation of infrastructure costs
---
####
infra-cost history - Git Cost History (NEW in v1.3.0)Correlate cost changes with git commits - see which code changes impact costs!
`bash
Show cost history with git correlation
infra-cost history --gitOutput:
๐ Cost History with Git Correlation
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Date Cost Change Commit
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
2026-01-28 $142.30 +$12.40 abc1234 Add GPU instances
2026-01-27 $129.90 +$45.20 def5678 Deploy new RDS
2026-01-26 $84.70 -$8.30 ghi9012 Cleanup unused EBS
2026-01-25 $93.00 +$3.10 jkl3456 Update Lambda memory
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
#
๐ Significant cost changes:
โข +$45.20 on 2026-01-27: def5678 "Deploy new RDS for analytics"
โข +$12.40 on 2026-01-28: abc1234 "Add GPU instances for ML"
Analyze specific commit
infra-cost history --commit abc1234Who caused the most cost changes this month?
infra-cost blame --period month
`Features:
- ๐ Cost-commit correlation - see which commits changed costs
- ๐ค Author attribution - track cost impact by developer
- ๐ Trend analysis - understand cost evolution over time
- ๐ Commit details - deep dive into specific commits
- ๐ Multiple formats - text, JSON, markdown output
- โ ๏ธ Significant change alerts - highlight big cost impacts
Commands:
`bash
Show cost history for the past week (default)
infra-cost history --gitShow history for different periods
infra-cost history --period month
infra-cost history --period quarterFilter by author
infra-cost history --author john@example.comAnalyze specific commit
infra-cost history --commit abc1234Blame analysis - who impacted costs most?
infra-cost blame --period monthExport to JSON for analysis
infra-cost history --format json > cost-history.json
`Perfect for:
- Engineering teams tracking cost accountability
- Understanding which features drive costs
- Cost-aware code reviews
- FinOps culture and awareness
- Retrospectives on cost trends
---
####
infra-cost terraform - Terraform Cost Preview (NEW in v1.4.0)Estimate infrastructure costs BEFORE deploying - shift-left cost management!
`bash
Generate terraform plan and estimate costs
terraform plan -out=tfplan
infra-cost terraform --plan tfplanOutput:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Terraform Cost Estimate โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Resources to CREATE: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ + aws_instance.web_server (t3.xlarge) โ
โ โโโ Monthly: $121.47 | Hourly: $0.1664 โ
โ + aws_db_instance.primary (db.r5.large, 100GB gp2) โ
โ โโโ Monthly: $182.80 | Hourly: $0.25 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Resources to MODIFY: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ~ aws_instance.api_server โ
โ โโโ t3.medium โ t3.large: +$30.37/month โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Resources to DESTROY: โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ - aws_instance.old_server โ
โ โโโ Savings: -$60.74/month โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ SUMMARY โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Current Monthly Cost: $1,240.50 โ
โ Estimated New Cost: $1,520.83 โ
โ Difference: +$280.33/month (+22.6%) โ
โ โ
โ โ ๏ธ Cost increase exceeds 20% threshold! โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
`Usage Examples:
`bash
Basic cost estimate
terraform plan -out=tfplan
infra-cost terraform --plan tfplanWith cost threshold (fail if > 20% change)
infra-cost terraform --plan tfplan --threshold 20JSON format for automation
infra-cost terraform --plan tfplan --output jsonFrom JSON plan
terraform show -json tfplan > tfplan.json
infra-cost terraform --plan tfplan.json
`Supported Resources:
- โ
EC2 instances (all types)
- โ
RDS instances with storage
- โ
EBS volumes (gp2, gp3, io1, io2, st1, sc1)
- โ
Load Balancers (ALB, NLB, CLB)
- โ
NAT Gateways
- โ
ElastiCache clusters
- โ
S3 buckets (estimated)
- โ
Lambda functions (estimated)
Perfect for:
- CI/CD cost gates
- Preventing expensive deployments
- Cost-aware infrastructure changes
- Shift-left FinOps culture
- Pre-deployment cost reviews
---
$3
| Command Usage | Old Command (v0.x) | New Command (v1.0) |
|--------------|-------------------|-------------------|
| Cost Analysis |
| Default cost analysis |
infra-cost | infra-cost cost analyze |
| Show cost deltas | infra-cost --delta | infra-cost cost analyze --show-delta |
| Cost trends | infra-cost --trends 30 | infra-cost cost trends --period 30d |
| Compare clouds | infra-cost --compare-clouds aws,gcp | infra-cost cost compare --providers aws,gcp |
| Forecast costs | infra-cost --forecast 30 | infra-cost cost forecast --days 30 |
| Optimization |
| Optimization recommendations | infra-cost --finops | infra-cost optimize recommendations |
| Quick wins | infra-cost --quick-wins | infra-cost optimize quickwins |
| Rightsizing | infra-cost --rightsize | infra-cost optimize rightsizing |
| Cross-cloud optimization | infra-cost --optimization-report | infra-cost optimize cross-cloud |
| Monitoring & Alerts |
| Cost alerts | infra-cost --alerts | infra-cost monitor alerts |
| Budget monitoring | infra-cost --budgets | infra-cost monitor budgets |
| Real-time monitoring | infra-cost --monitor | infra-cost monitor watch |
| Anomaly detection | infra-cost --anomaly-detect | infra-cost monitor anomaly |
| Export & Reports |
| Export inventory (JSON) | infra-cost --inventory | infra-cost export inventory json |
| Export inventory (CSV) | infra-cost --inventory-export csv | infra-cost export inventory csv |
| Export inventory (Excel) | infra-cost --inventory-export xlsx | infra-cost export inventory xlsx |
| Export inventory (PDF) | infra-cost --inventory-export pdf | infra-cost export inventory pdf |
| AWS Organizations |
| List accounts | infra-cost --organizations | infra-cost organizations list |
| Organization summary | infra-cost --organizations-summary | infra-cost organizations summary |
| Daily costs | infra-cost --organizations-daily | infra-cost organizations daily |
| Chargeback |
| Chargeback report | infra-cost --chargeback | infra-cost chargeback report |
| Send to Slack | infra-cost --chargeback-slack | infra-cost chargeback slack |
| Dashboards |
| Interactive dashboard | infra-cost --dashboard | infra-cost dashboard interactive |
| Multi-cloud dashboard | infra-cost --dashboard-multicloud | infra-cost dashboard multicloud |
| Configuration |
| Show configuration | infra-cost --config-status | infra-cost config show |
| Generate configuration | infra-cost --config-generate | infra-cost config init |
| Validate configuration | infra-cost --config-validate | infra-cost config validate |
| Migrate configuration | N/A (new in v1.0) | infra-cost config migrate |$3
-
cost - Cost analysis, trends, comparisons, and forecasting
- optimize - Optimization recommendations and analysis
- monitor - Alerts, budgets, and anomaly detection
- export - Export data in multiple formats
- organizations - AWS Organizations multi-account support
- chargeback - Cost allocation and reporting
- config - Configuration management
- dashboard - Interactive dashboardsGet help for any command:
`bash
infra-cost --help
infra-cost cost --help
infra-cost cost analyze --help
`๐ฆ Installation
$3
`bash
npm install -g infra-cost
`$3
`bash
brew tap codecollab-co/tap
brew install infra-cost
`$3
`bash
npx infra-cost
`$3
`bash
docker run --rm codecollab-co/infra-cost --help
`$3
`yaml
- uses: codecollab-co/infra-cost@v0.3.0
with:
provider: aws
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
`๐ฏ Quick Start
$3
`bash
Analyze costs with default AWS credentials
infra-cost cost analyzeShow cost trends over time
infra-cost cost trends --period 30dCompare costs across multiple providers
infra-cost cost compare --providers aws,gcp
`$3
`bash
Analyze GCP costs with service account
infra-cost cost analyze \
--provider gcp \
--project-id my-project \
--key-file /path/to/service-account.jsonList all accessible GCP projects
infra-cost cost analyze \
--provider gcp \
--project-id my-project \
--list-projectsAnalyze costs with custom billing dataset
infra-cost cost analyze \
--provider gcp \
--project-id my-project \
--billing-dataset custom_billing \
--billing-table custom_tableCompare costs across multiple GCP projects
infra-cost cost compare \
--provider gcp \
--projects project-1,project-2,project-3
`$3
`bash
Get AI-powered optimization recommendations
infra-cost optimize recommendationsFind quick wins for immediate savings
infra-cost optimize quickwinsGet rightsizing recommendations
infra-cost optimize rightsizing
`$3
`bash
Check cost alerts and budget status
infra-cost monitor alertsMonitor budgets
infra-cost monitor budgetsDetect cost anomalies
infra-cost monitor anomaly
`$3
`bash
Send cost report to Slack
infra-cost chargeback slackGenerate chargeback report
infra-cost chargeback reportInteractive dashboard
infra-cost dashboard interactive
`๐ Authentication
$3
#### 1. Environment Variables (Recommended)
`bash
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_REGION=us-east-1
infra-cost cost analyze
`#### 2. AWS Profiles
`bash
Use default profile
infra-cost cost analyzeUse specific profile
infra-cost cost analyze --profile productionDiscover available profiles
infra-cost config show --discover-profiles
`#### 3. IAM Roles (EC2/Lambda/ECS)
`bash
Automatically uses attached IAM role
infra-cost cost analyze
`#### 4. AWS SSO
`bash
aws sso login --profile my-sso-profile
infra-cost cost analyze --profile my-sso-profile
`#### 5. Configuration File
`bash
Initialize configuration
infra-cost config initValidate configuration
infra-cost config validateShow current configuration
infra-cost config show
`$3
#### 1. Service Account Key File (Recommended)
`bash
Download service account key from GCP Console
IAM & Admin > Service Accounts > Create Key (JSON)
export GOOGLE_PROJECT_ID=your-project-id
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
infra-cost cost analyze --provider gcp
`#### 2. Application Default Credentials (ADC)
`bash
Authenticate with gcloud CLI
gcloud auth application-default loginSet default project
gcloud config set project your-project-idRun infra-cost
infra-cost cost analyze --provider gcp --project-id your-project-id
`#### 3. Command-Line Arguments
`bash
infra-cost cost analyze \
--provider gcp \
--project-id my-project \
--key-file /path/to/service-account.json
`#### 4. Configuration File
`bash
Initialize configuration with GCP
infra-cost config initEdit ~/.infra-cost/config.json
{
"provider": "gcp",
"credentials": {
"projectId": "my-project",
"keyFilePath": "/path/to/service-account.json",
"billingDatasetId": "billing_export",
"billingTableId": "gcp_billing_export"
}
}
`#### GCP Permissions Required
Your service account needs the following IAM permissions:
-
resourcemanager.projects.get - Read project information
- bigquery.jobs.create - Query billing data
- bigquery.tables.getData - Read billing tablesRecommended IAM Role:
roles/bigquery.user + custom role for project access#### Enable BigQuery Billing Export
infra-cost requires BigQuery billing export to be enabled:
1. Go to GCP Billing Console
2. Select your billing account
3. Navigate to "Billing export"
4. Enable "BigQuery export"
5. Configure dataset (default:
billing_export)
6. Wait 24 hours for initial data$3
`bash
Google Cloud Platform
infra-cost cost analyze --provider gcp --project-id my-project --key-file service-account.jsonMicrosoft Azure (Coming Soon)
infra-cost cost analyze --provider azure --subscription-id sub-id --tenant-id tenant-idOracle Cloud (Coming Soon)
infra-cost cost analyze --provider oracle --user-id user-ocid --tenancy-id tenancy-ocidCross-cloud comparison
infra-cost cost compare --providers aws,gcpCross-cloud optimization report (Coming Soon)
infra-cost optimize cross-cloud
`๐ Output Examples
$3
`bash
infra-cost cost analyze --output fancy
`
!Cost Analysis$3
`bash
Export inventory to JSON
infra-cost export inventory jsonExport to CSV
infra-cost export inventory csvExport to Excel
infra-cost export inventory xlsxExport to PDF
infra-cost export inventory pdf
`$3
`bash
infra-cost cost analyze --output json
`$3
Real-time cost monitoring with keyboard navigation
`bash
Launch interactive TUI dashboard (shortcut)
infra-cost dashboardOr explicitly
infra-cost dashboard interactiveCustom refresh interval (default: 60 seconds)
infra-cost dashboard --refresh 30Multi-cloud dashboard
infra-cost dashboard multicloud
`Features:
- ๐จ Beautiful terminal UI with real-time updates
- โจ๏ธ Full keyboard navigation (vim-style supported)
- ๐ Multiple views: Services, Resources, Trends, Alerts
- ๐ Live trend indicators (โ up, โ down, โ stable)
- ๐ Real-time alert notifications
- ๐ Auto-refresh with configurable intervals
- ๐ฏ Drill-down into services and resources
Keyboard Shortcuts:
`
q - Quit
r - Refresh data
โโ/jk - Navigate rows
โโ/hl - Switch tabs
1-4 - Quick tab switch
? - Help
`Perfect for:
- DevOps engineers monitoring costs in terminal
- SREs with terminal-based workflows
- Real-time cost exploration
- Server environments without GUI
๐ฌ Slack Integration
$3
- Rich cost breakdowns with visual charts
- Proactive alerts for budget overruns and anomalies
- Automated workflows for approval processes
- Team cost awareness with regular updates$3
`bash
Configure Slack credentials (one-time setup)
export SLACK_TOKEN=xoxb-your-token
export SLACK_CHANNEL="#finops"Send chargeback report to Slack
infra-cost chargeback slackOr provide inline
infra-cost chargeback slack --slack-token xoxb-your-token --slack-channel "#finops"
`$3
`yaml
name: Daily FinOps Report
on:
schedule:
- cron: '0 9 1-5' # Weekdays 9 AM UTC
jobs:
cost-report:
runs-on: ubuntu-latest
steps:
- run: |
npx infra-cost chargeback slack \
--slack-token ${{ secrets.SLACK_TOKEN }} \
--slack-channel ${{ secrets.SLACK_CHANNEL }}
`๐ค GitHub Actions Integration (v1.4.0+)
infra-cost is available as a GitHub Action, making it easy to integrate cost analysis into your CI/CD workflows with cost gates and automated PR comments.
$3
`yaml
name: Cost Analysis
on: [pull_request]jobs:
cost-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codecollab-co/infra-cost@v1.4.0
with:
provider: aws
command: now
comment-on-pr: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
`$3
`yaml
name: Cost Gate
on: pull_requestjobs:
cost-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codecollab-co/infra-cost@v1.4.0
with:
provider: aws
command: now
fail-on-increase: true # Fail if ANY cost increase
cost-threshold: 1000 # Fail if monthly cost exceeds $1000
comment-on-pr: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
`$3
`yaml
name: Terraform Cost Check
on: pull_requestjobs:
terraform-cost:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Terraform Plan
run: terraform plan -out=tfplan
- name: Cost Estimate
uses: codecollab-co/infra-cost@v1.4.0
with:
command: terraform
additional-args: '--plan tfplan --threshold 20'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
`$3
`yaml
name: Daily Cost Report
on:
schedule:
- cron: '0 9 *'jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: codecollab-co/infra-cost@v0.3.0
with:
provider: aws
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
analysis-type: finops
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
`$3
| Input | Description | Default |
|-------|-------------|---------|
|
provider | Cloud provider (aws, gcp, azure, alicloud, oracle) | aws |
| profile | Cloud provider profile | default |
| region | Cloud provider region | us-east-1 |
| aws-access-key-id | AWS Access Key ID | - |
| aws-secret-access-key | AWS Secret Access Key | - |
| analysis-type | Type of analysis (summary, detailed, delta, forecast, anomaly, finops, audit) | summary |
| forecast-days | Days for forecast | 30 |
| delta-threshold | Alert threshold for cost changes (%) | 10 |
| output-format | Output format (text, json) | text |
| slack-webhook | Slack webhook URL | - |
| comment-on-pr | Post analysis as PR comment | false |
| fail-on-threshold | Fail if costs exceed threshold | false |$3
| Output | Description |
|--------|-------------|
|
total-cost | Total cost for the analysis period |
| cost-change | Cost change percentage |
| forecast-cost | Forecasted cost |
| anomalies-detected | Number of anomalies detected |
| report-json | Full report in JSON format |See example workflows for more use cases.
๐ง Advanced Usage
$3
#### Multi-Account Management
`bash
List all accounts in organization
infra-cost organizations listGet organization-wide cost summary
infra-cost organizations summary
`#### Daily Cost Reports with Slack Integration
`bash
Get daily costs for all accounts
infra-cost organizations dailySend daily report to Slack
infra-cost organizations daily --slack-webhook https://hooks.slack.com/services/YOUR/WEBHOOK/URLView 30-day history
infra-cost organizations daily --days 30Get scheduling instructions for automated daily reports
infra-cost organizations daily --schedule-daily --schedule-time 09:00Export to JSON for automation
infra-cost organizations daily --json
`Features:
- ๐ Multi-account cost breakdown
- ๐ Day-over-day cost trends with visual indicators
- ๐ฅ Top 5 spender accounts
- ๐ Weekly averages and projections
- ๐ฌ Slack webhook integration for team notifications
- โฐ Scheduling instructions (cron, Lambda, GitHub Actions)
Perfect for:
- Large organizations with multiple AWS accounts
- FinOps teams managing cross-account costs
- Daily cost visibility and team accountability
- Automated cost reporting workflows
$3
`bash
Analyze costs with delta comparison
infra-cost cost analyze --show-delta --delta-threshold 10Get cost trends
infra-cost cost trends --period 90dCompare costs across providers
infra-cost cost compare --providers aws,gcp,azureForecast future costs
infra-cost cost forecast --days 30
`$3
`bash
Get all optimization recommendations
infra-cost optimize recommendationsFind quick wins for immediate savings
infra-cost optimize quickwinsGet rightsizing recommendations
infra-cost optimize rightsizingCross-cloud optimization analysis
infra-cost optimize cross-cloud
`$3
`bash
Check cost alerts
infra-cost monitor alertsMonitor budgets
infra-cost monitor budgetsWatch for cost changes in real-time
infra-cost monitor watchDetect anomalies
infra-cost monitor anomaly
`$3
`bash
Initialize new configuration
infra-cost config initShow current configuration
infra-cost config showValidate configuration
infra-cost config validateMigrate from old version
infra-cost config migrate
`๐๏ธ Architecture & Extensibility
$3
`
src/
โโโ cli/ # CLI layer
โ โโโ commands/ # Subcommand structure
โ โ โโโ cost/ # Cost analysis commands
โ โ โโโ optimize/ # Optimization commands
โ โ โโโ monitor/ # Monitoring commands
โ โ โโโ export/ # Export commands
โ โ โโโ organizations/ # AWS Organizations commands
โ โ โโโ chargeback/ # Chargeback commands
โ โ โโโ config/ # Configuration commands
โ โ โโโ dashboard/ # Dashboard commands
โ โโโ middleware/ # Auth, validation, error handling
โ โโโ index.ts # CLI entry point
โโโ core/ # Core business logic
โ โโโ config/ # Configuration system
โ โ โโโ schema.ts # Zod validation schemas
โ โ โโโ loader.ts # Config file loading
โ โ โโโ discovery.ts # Profile discovery
โ โ โโโ profiles.ts # Profile management
โ โโโ logging/ # Structured logging
โ โโโ analytics/ # Cost analytics engines
โ โโโ optimization/ # Optimization engines
โ โโโ monitoring/ # Monitoring systems
โโโ providers/ # Cloud provider implementations
โ โโโ factory.ts # Provider factory
โ โโโ aws/ # AWS implementation โ
โ โโโ provider.ts # Main provider class
โ โโโ cost.ts # Cost Explorer integration
โ โโโ account.ts # Account/Organizations
โ โโโ config.ts # AWS-specific config
โโโ exporters/ # Output formatters
โ โโโ formats/
โ โโโ fancy.ts # Rich terminal output
โ โโโ json.ts # JSON output
โ โโโ text.ts # Plain text
โ โโโ slack.ts # Slack formatting
โโโ enterprise/ # Enterprise features
โโโ multi-tenant/ # Multi-tenancy support
โโโ audit/ # Audit logging
`$3
- Subcommand Architecture - Domain-organized, discoverable commands
- Clean Separation - CLI, core logic, and providers are decoupled
- Type Safety - Comprehensive TypeScript with Zod validation
- Testability - Dependency injection and mocking support
- Extensibility - Plugin architecture for new providers
- Configuration First - Unified config system with profiles๐ Roadmap
$3
Core Platform & Architecture:
- โ
Enhanced terminal UI and visualization
- โ
AI-powered anomaly detection
- โ
Comprehensive PDF reporting
- โ
Advanced Slack integration
- โ
GitHub Actions integration
- โ
npm and Homebrew distribution
- โ
Phase 1: Clean Architecture Restructuring (v1.0)
- Subcommand-based CLI architecture
- Unified configuration system with profiles
- Automatic cloud profile discovery
- Structured logging with audit trails
- AWS Organizations support (Issue #10 โ
)
- Cost allocation and chargeback reporting (Issue #30 โ
)
- Configuration file support (Issue #29 โ
)
- Caching layer for performance (Issue #28 โ
)
- IAM Roles and environment variables auth (Issues #12, #13 โ
)
- AWS SSO login support (Issue #9 โ
)
Multi-Cloud Foundation:
- โ
Multi-cloud provider architecture (Issue #20 - foundation)
- AWS provider fully implemented
- GCP, Azure, Alibaba Cloud, Oracle Cloud - architecture ready
$3
Priority: Multi-Cloud Expansion
- โ
Google Cloud Platform support - COMPLETE (Issue #66)
- โ
Provider implementation with BigQuery billing export
- โ
GCP authentication (service account, ADC)
- โ
Multi-project support with parallel retrieval
- โ
Multi-currency cost aggregation
- โ
Cost breakdown by service and time period
- โ
Resource inventory (GCE, Storage, SQL, GKE)
- โ
Budget tracking and alerts
- โ
Organization-level cost aggregation
- โ
Comprehensive documentation and examples
- โ
65 unit tests passing (100% coverage)
- ๐ Advanced forecasting models (No GitHub issue)
- ML-based cost predictions
- Seasonal trend analysis
- Budget recommendations
- ๐ Enhanced analytics (No GitHub issue)
- Advanced cost attribution
- Custom tagging strategies
- Cost optimization scoring
$3
Priority: Complete Multi-Cloud & Automation
- ๐ฎ Microsoft Azure integration (Issue #20 - partial)
- Azure Cost Management API
- Subscription and resource group support
- Azure-specific recommendations
- ๐ฎ Alibaba Cloud support (Issue #20 - partial)
- Alibaba Cloud Cost API integration
- Multi-region support
- ๐ฎ Oracle Cloud support (Issue #20 - partial)
- OCI Cost Management integration
- Compartment-based analysis
- ๐ Advanced automation engine (No GitHub issue)
- Automated cost optimization actions
- Policy-based automation
- Approval workflows
- Related: Issue #42 (Scheduled Reports), Issue #49 (API Server)
$3
Priority: Developer Experience & IDE Integration
- โ
Interactive TUI Dashboard (Issue #43)
- React Ink-based terminal UI
- Real-time cost monitoring with keyboard navigation
- Multiple views: Services, Resources, Trends, Alerts
- โ
Cost Annotations for IaC Files (Issue #54)
- Terraform and CloudFormation cost comments
- Inline optimization suggestions
- Update/remove annotations
- โ
Git Cost History (Issue #56)
- Cost-commit correlation
- Blame analysis by author
- Historical trend analysis
- ๐ฎ VS Code Extension (Issue #55 - Planned)
- Inline cost display for Terraform/CloudFormation
- Sidebar panel with cost summaries
- CodeLens integration
- Hover information with alternatives
- Note: VS Code extension will be a separate repository
- Integration points with CLI for cost data
$3
Priority: CI/CD Integration & Shift-Left Cost Management
- โ
GitHub Actions Integration (Issue #46)
- Native GitHub Action for cost analysis in PRs
- Cost gates with fail-on-increase and threshold checks
- Enhanced PR comments with cost breakdown
- Multiple output variables for downstream jobs
- Slack notification support
- โ
Terraform Cost Preview (Issue #47)
- Parse terraform plan files (binary and JSON)
- Estimate costs before deployment
- Show create/modify/destroy breakdown
- Cost threshold gates for CI/CD
- Support for EC2, RDS, EBS, Load Balancers, and more
- Monthly and hourly cost estimates
- Shift-left cost management
$3
Priority: Communication & Collaboration
- โ
Scheduled Reports with Daemon Mode (Issue #42)
- Built-in scheduler daemon for automated reports
- Cron-based scheduling with timezone support
- Multiple schedules per instance
- Systemd service file generation
- Execution logs and status monitoring
- โ
Microsoft Teams Integration (Issue #45)
- Incoming webhook support with Adaptive Cards
- Multiple card styles (compact, detailed, executive)
- Cost summaries and alert integration
- Chargeback reports for Teams
- โ
PagerDuty & OpsGenie Integration (Issue #48)
- PagerDuty Events API v2 support
- OpsGenie Alert API integration
- Severity/priority mapping
- Auto-resolve functionality
- Deduplication to prevent spam
- โ
Email Report Scheduling (Issue #58)
- SendGrid and Mailgun support
- Beautiful HTML email templates
- Multiple recipient support
- Scheduler integration for automated emails
- Plain text fallback
$3
Priority: Enterprise Features
- โ
/๐ง Enterprise SSO integration
- AWS SSO: โ
Completed (Issue #9)
- SAML/OAuth support: ๐ฒ Planned (Issue #52)
- Azure AD, Okta, Auth0 integration: ๐ฒ Planned
- Role-based access control (RBAC): ๐ฒ Planned (Issue #50)
- ๐ Custom plugin system (No GitHub issue)
- Plugin SDK
- Custom provider support
- Third-party integrations
- ๐ Mobile app companion (No GitHub issue)
- iOS and Android apps
- Real-time cost alerts
- Executive dashboards on mobile
$3
FinOps & Intelligence:
- ๐ Sustainability tracking expansion (No GitHub issue)
- Carbon footprint tracking
- Green cloud recommendations
- Renewable energy usage analytics
- ๐ฒ FinOps best practices automation (Issue #59 - partial)
- FinOps Scorecards implementation
- Automated best practices enforcement
- Team performance metrics
- ๐ฒ AI-powered cost conversations (Issue #44 - partial)
- Natural language cost queries
- ChatOps integration
- AI cost assistant
Platform & Scale:
- ๐ Multi-tenant SaaS platform (No GitHub issue)
- Organization management
- Team collaboration features
- Centralized cost governance
- ๐ฒ Additional integrations (Various open issues)
- Microsoft Teams (Issue #45)
- PagerDuty/OpsGenie (Issue #48)
- Terraform cost preview (Issue #47)
- API Server mode (Issue #49)
- Multi-cloud dashboard (Issue #62)
- Web-based dashboards (Issue #60)
Legend:
- โ
Completed
- ๐ง In Progress
- ๐ฎ Planned (this quarter)
- ๐ฒ Open GitHub Issue
- ๐ Not yet tracked in GitHub issues
๐ Requirements & Permissions
$3
`json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InfraCostMinimalPermissions",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"ce:GetCostAndUsage",
"ce:GetRightsizingRecommendation",
"ce:GetSavingsUtilization",
"budgets:ViewBudget",
"sts:GetCallerIdentity"
],
"Resource": "*"
}
]
}
`$3
- Node.js 20+ (required)
- Memory: 512MB+ available
- Network: Internet access for cloud provider APIs
- Optional: Docker for containerized deployments๐งช Development
docs/ folder for comprehensive technical documentation including architecture guides, testing reports, and release procedures.$3
`bash
Clone repository
git clone https://github.com/codecollab-co/infra-cost.git
cd infra-costInstall dependencies
npm installBuild project
npm run buildRun tests
npm testStart development server
npm run dev
`$3
`bash
Type checking
npm run typecheckLinting
npm run lintSecurity audit
npm auditTest coverage
npm run test:coverage
`$3
`bash
Check current version status
npm run version:checkBump version
npm run version:bump:patch # Bug fixes
npm run version:bump:minor # New features
npm run version:bump:major # Breaking changesPrepare release
npm run prepare-release
`๐ค Contributing
We welcome contributions from the community! Here's how you can help:
$3
- โญ Star this repository to show your support
- ๐ Report bugs and suggest improvements via issues
- ๐ Improve documentation - help others understand and use the tool
- ๐ง Add cloud provider support - help us expand to more providers
- ๐งช Write tests - improve code quality and reliability
- ๐ก Suggest features - share your ideas for new capabilities$3
1. Fork the repository
2. Clone your fork: git clone https://github.com/YOUR_USERNAME/infra-cost.git
3. Create a branch: git checkout -b feature/amazing-feature
4. Make changes and write tests
5. Run quality checks: npm run typecheck && npm run lint && npm test
6. Commit: git commit -m "Add amazing feature"
7. Push: git push origin feature/amazing-feature
8. Create a Pull Request$3
- Follow the existing code style and conventions
- Add tests for new features
- Update documentation as needed
- Keep PRs focused on a single feature/fix
- Be respectful and constructive in discussions$3
Look for issues labeled good first issue or help wanted to get started!๐ Support & Community
$3
- ๐ Documentation: docs.codecollab.co/infra-cost (coming soon)
- ๐ Bug Reports: GitHub Issues
- ๐ก Feature Requests: GitHub Discussions
- ๐ง Email Support: support@codecollab.co$3
If infra-cost helps you save money and optimize costs, please:
- โญ Star this repository
- ๐ฆ Share on Twitter with #InfraCost #FinOps
- ๐ Write a review or blog post about your experience
- ๐ค Contribute code, documentation, or feedback$3
For enterprise deployments, custom integrations, and professional support:
- ๐ง Contact: enterprise@codecollab.co
- ๐ SLA-backed support available
- ๐จ Custom branding and whitelabeling
- ๐๏ธ Professional services and consulting๐ Documentation
$3
- README.md - Main project documentation (you are here)
- CHANGELOG.md - Version history and release notes
- CONTRIBUTING.md - Contribution guidelines$3
Comprehensive technical documentation is available in the docs/ folder:- docs/RELEASE_SUMMARY.md - Complete release guide for GitHub, npm, and Homebrew
- docs/PRODUCTION_READINESS.md - Production readiness assessment and checklist
- docs/TEST_RESULTS.md - Comprehensive test results and analysis
- docs/NPM_PUBLISHING.md - npm publishing workflow and best practices
- docs/HOMEBREW_SETUP.md - Homebrew formula creation guide
- docs/code_flow.md - Codebase architecture and flow
- docs/infra_cost_cli.md - CLI implementation details
- docs/MULTI-CLOUD-INVENTORY.md - Multi-cloud features
- docs/ENHANCED-FEATURES.md - Advanced capabilities
See docs/README.md for the complete documentation index.
๐ License
MIT ยฉ Code Collab
---
๐ Changelog
$3
- โ
Subcommand-Based CLI - New organized command structure
- cost - Cost analysis and trends
- optimize - Optimization recommendations
- monitor - Alerts and monitoring
- export - Data export in multiple formats
- organizations - AWS Organizations support
- chargeback - Cost allocation and reporting
- config - Configuration management
- dashboard - Interactive dashboards
- โ
Unified Configuration System - Single config file with profiles
- โ
Profile Discovery - Auto-detect cloud provider profiles
- โ
Clean Architecture - Separation of CLI, core, and providers
- โ
Enhanced Logging - Structured logging with multiple outputs
- โ
Migration Tool - Automated migration from v0.x (infra-cost config migrate`)Breaking Changes: See MIGRATION_GUIDE.md for upgrading from v0.x
---
Made with โค๏ธ by Code Collab
Empowering teams to optimize cloud costs and build sustainable infrastructure
โญ Star us on GitHub โข ๐ฆ Follow on Twitter โข ๐ผ LinkedIn