Skip to main content

Environment Variables

Cloud Cost Analyzer can be configured using environment variables. These are useful for CI/CD pipelines and automation.

CCA Configuration

Each of these mirrors a global CLI flag; the flag takes precedence when both are set.

VariableDescriptionDefault
CCA_API_KEYAPI key for managed mode (sends results to the dashboard)-
CCA_MODEExecution mode: managed or local (local needs an air-gapped build)managed
CCA_LICENSEBase64-encoded license key (premium/air-gapped)-
CCA_LICENSE_FILEPath to a license file (premium/air-gapped)-
CCA_BUNDLE_PATHPath to a signed rule bundle (air-gapped)-

Output format and logging are set with flags, not env vars: --output, and --verbose / --log-level / --log-format / --log-file. To store the API key instead of exporting it each run, use cca login.

AWS Credentials

CCA uses the standard AWS credential chain. You can configure credentials using:

VariableDescription
AWS_ACCESS_KEY_IDAWS access key
AWS_SECRET_ACCESS_KEYAWS secret key
AWS_SESSION_TOKENSession token (for temporary credentials)
AWS_REGIONAWS region to scan
AWS_PROFILENamed profile from ~/.aws/credentials
AWS_DEFAULT_REGIONFallback region

Credential Priority

  1. Environment variables (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY)
  2. Shared credentials file (~/.aws/credentials)
  3. IAM role (if running on EC2/ECS/Lambda)

Azure Credentials

CCA uses service principal authentication for Azure:

VariableDescription
AZURE_CLIENT_IDService principal application ID
AZURE_CLIENT_SECRETService principal secret
AZURE_TENANT_IDAzure AD tenant ID
AZURE_SUBSCRIPTION_IDSubscription ID to scan

Setting Up Azure Credentials

# Create a service principal with Reader access
az ad sp create-for-rbac \
--name "cca-reader" \
--role Reader \
--scopes /subscriptions/YOUR_SUBSCRIPTION_ID

# Output:
# {
# "appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <- AZURE_CLIENT_ID
# "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <- AZURE_CLIENT_SECRET
# "tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" <- AZURE_TENANT_ID
# }

Example: Full CI Configuration

# .env.ci (load with source or dotenv)

# CCA
CCA_API_KEY=cca_live_xxxxxxxxxxxxx

# AWS
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS_REGION=us-east-1

# Azure (optional)
AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_CLIENT_SECRET=your-secret
AZURE_TENANT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
AZURE_SUBSCRIPTION_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
caution

Never commit credential files to version control. Use your CI system's secret management to inject these values.

Next Steps