Skip to main content

Command Reference

Complete reference for the CCA CLI. The binary is cca.

cca scan executive summary: total spend, potential savings, cost by service, and top recommendations

note

Resource IDs are redacted in the example images on this page.

Global Options

These options apply to every command (they may appear before or after the subcommand):

OptionShortDefaultDescription
--help-hShow help information
--version-VShow version number
--verbose-voffEnable console logging (logs are silent by default)
--log-levelinfoLog level: error, warn, info, debug, trace
--log-formatcompactLog format: json, pretty, compact
--log-fileWrite logs to a file (enables logging regardless of --verbose)
--modemanagedExecution mode: managed, local (local requires an air-gapped build). Env: CCA_MODE
--api-keyAPI key for managed mode. Env: CCA_API_KEY
--license-filePath to a license file. Env: CCA_LICENSE_FILE
--license-keyBase64-encoded license key. Env: CCA_LICENSE
--bundle-pathPath to a signed rule bundle (air-gapped). Env: CCA_BUNDLE_PATH

For managed mode you can avoid passing --api-key on every run — see login.

Commands

scan

Scan cloud resources for cost optimization opportunities.

cca scan [OPTIONS]

Options

OptionShortDefaultDescription
--provider-pawsCloud provider: aws, azure
--regions-rus-east-1Comma-separated regions, e.g. us-east-1,us-west-2
--services-sallComma-separated service categories: compute, storage, database, networking, serverless, analytics, containers, ai, security, monitoring, cdn, other
--days-d7Days of metrics to analyze
--output-otableOutput format: table, json, yaml, markdown, csv, sarif, pdf
--output-file-fstdoutWrite output to a file
--group-by-tagsGroup findings by tag key for cost allocation (e.g. Team)
--min-costOnly include findings above this monthly USD amount
--include-hygienefalseInclude $0-savings hygiene findings (hidden by default; High/Critical findings are always shown)
--allfalseShow all findings (default: top 10)
--topMaximum number of findings to display
--no-recommendationsfalseHide recommendations in output
--dumpDump all raw data (resources, metrics, costs, findings) to a JSON file
--summaryfalseSummary only (default: detailed report with remediation)
--skip-costsfalseSkip cost collection (useful for LocalStack testing)

Global options (--mode, --api-key, …) also apply.

Examples

# Basic AWS scan (managed mode is the default)
cca scan --provider aws

# Scan specific regions
cca scan --provider aws --regions us-east-1,us-west-2

# Output as JSON to a file
cca scan --provider aws --output json --output-file results.json

# Show all findings, not just the top 10
cca scan --provider aws --all

# Filter resources by tag

# Only findings worth more than $50/mo
cca scan --provider aws --min-cost 50

# Azure scan
cca scan --provider azure

# Debug logging
cca scan --provider aws --log-level debug

Output Formats

  • table (default) — human-readable console output.
  • json — structured JSON for programmatic use.
  • yaml — YAML equivalent of the JSON output.
  • markdown — a Markdown report (handy for PRs / wikis).
  • csv: one row per finding, for spreadsheets and FinOps workflows.
  • sarif: SARIF 2.1.0, for CI code scanning (GitHub, GitLab). Upload with github/codeql-action/upload-sarif.
  • pdf — a standalone PDF report.

Machine-readable formats (json, yaml, markdown, csv, sarif) print no progress noise, so they pipe cleanly.

Example output

The default table output leads with the executive summary above, then lists findings by severity — each with the evidence behind it and a remediation step:

cca scan detailed findings grouped by severity, each with evidence and a remediation step


audit

Generate a comprehensive infrastructure cost audit, with optional cost-allocation grouping, tag-compliance checks, and trend comparison against a previous run.

cca audit [OPTIONS]

Options

OptionShortDefaultDescription
--provider-pawsCloud provider: aws, azure
--regions-rus-east-1Comma-separated regions
--services-sallComma-separated service categories (see scan)
--days-d7Days of metrics to analyze
--output-otableOutput format: table, json, yaml, markdown, csv, sarif, pdf
--output-file-fstdoutWrite output to a file
--group-by-tagsGroup costs by these tag keys (comma-separated)
--compareCompare to a previous audit JSON for trend analysis
--cost-thresholdMinimum cost (USD) to include in the breakdown
--tag-policyPath to a tag policy file (YAML/JSON) for compliance validation
--required-tagsRequired tag keys (comma-separated) — simpler alternative to --tag-policy
--skip-tag-compliancefalseSkip tag compliance validation
--allfalseShow all findings (default: top 10)
--topMaximum number of recommendations to display
--dumpDump all raw data to a JSON file
--summaryfalseSummary only
--skip-costsfalseSkip cost collection

Examples

# Full audit grouped by team tag
cca audit --provider aws --group-by-tags team,environment

# Trend vs a previous run
cca audit --provider aws --output json --output-file this-week.json
cca audit --provider aws --compare this-week.json

# Enforce required tags
cca audit --provider aws --required-tags owner,cost-center

report

Generate reports from a saved data dump (produced by scan/audit --dump). No cloud access required.

cca report <DUMP_FILE> [OPTIONS]

Options

OptionShortDefaultDescription
<DUMP_FILE>requiredPath to the data dump JSON file (positional)
--output-otableOutput format: table, json, yaml, markdown, csv, sarif, pdf
--output-file-fstdoutWrite output to a file
--group-by-tagsGroup costs by these tag keys (comma-separated)
--compareCompare to a previous audit JSON for trend analysis
--cost-thresholdMinimum cost (USD) to include in the breakdown
--severityallFilter by severity: critical, high, medium, low (comma-separated)
--regionsallFilter by region (comma-separated)
--servicesallFilter by service (comma-separated)
--allfalseShow all findings (default: top 10)
--topMaximum number of recommendations to display
--summaryfalseSummary only

Examples

# Re-render a saved dump as Markdown, high severity only
cca report dump.json --severity critical,high --output markdown

setup

Set up cloud provider access — generate or deploy a least-privilege read-only IAM role via CloudFormation.

cca setup [OPTIONS]

Options

OptionShortDefaultDescription
--provider-pawsCloud provider: aws, azure
--deployfalseDeploy the CloudFormation stack (create the IAM role)
--output-templatefalsePrint the CloudFormation template
--stack-namecloud-cost-analyzer-accessCloudFormation stack name
--role-nameCloudCostAnalyzerRoleIAM role name to create
--create-userfalseAlso create an IAM user with access keys
--user-namecloud-cost-analyzerIAM user name (with --create-user)
--external-idExternal ID for cross-account role assumption
--trusted-account-idTrusted AWS account ID (cross-account access)
--output-file-fWrite the template to a file
--region-rus-east-1AWS region for the deployment

Examples

# Print the CloudFormation template
cca setup --provider aws --output-template

# Deploy the read-only role
cca setup --provider aws --deploy

doctor

Run preflight diagnostics — checks credentials, IAM permissions, and connectivity, and prints a clear pass/warn/fail report. Run this first when a scan fails or isn't reaching the dashboard.

cca doctor [OPTIONS]

Options

OptionShortDefaultDescription
--provider-pawsCloud provider to diagnose: aws, azure
--jsonfalseEmit results as JSON (for CI / machine parsing)

doctor also reads the global --mode, --api-key / CCA_API_KEY, and stored credentials, so it validates the exact managed-mode setup a scan will use. It exits non-zero on hard failures, so it can gate automation.

Examples

# Diagnose the default AWS setup
cca doctor --provider aws

# Machine-readable output for CI
cca doctor --provider aws --json

login

Store your API key locally so scans don't need --api-key (or CCA_API_KEY) on every run. The key is saved to ~/.cloud-cost-analyzer/credentials.json with owner-only (0600) permissions and used as a fallback when no key is passed.

# Save the key already in your environment or passed via --api-key
CCA_API_KEY=cca_live_xxxxx cca login

# Or run it with no key set and paste it when prompted
cca login

Resolution precedence: --api-key flag > CCA_API_KEY env > stored credentials file.

logout

Remove the locally stored API key.

cca logout

license

Manage the air-gapped license.

cca license <SUBCOMMAND>
SubcommandDescription
fetch <CODE>Redeem an activation code and save the license locally
showShow the current license status
pathPrint the resolved license file path
refresh-crlRefresh the revocation-list cache for the current license
# Redeem an activation code from the dashboard
cca license fetch ABCD-1234

# Check status
cca license show

upgrade

Print how to start a paid subscription or free trial to unlock all findings.

cca upgrade

version

Show version information.

cca version

Output:

cloud-cost-analyzer 0.1.1

Environment Variables

The CLI reads these directly (see Environment Variables for the full list, including AWS/Azure credentials):

VariableMaps to
CCA_API_KEY--api-key
CCA_MODE--mode
CCA_LICENSE--license-key
CCA_LICENSE_FILE--license-file
CCA_BUNDLE_PATH--bundle-path

Exit Codes

CodeMeaning
0Success
non-zeroAn error occurred (invalid arguments, auth/permission failure, network error, or a hard doctor failure). Use --log-level debug for details.

Next Steps