Cost
Fetch AWS costs, detect anomalies, and get a 30-day spend forecast.
annave cost scan pulls daily spend from AWS Cost Explorer, groups it by service, flags anomalies against a 7-day rolling average, and fetches a 30-day forecast.
Usage
annave cost scan [flags]Flags
| Flag | Short | Default | Description |
|---|---|---|---|
| --provider | aws | Cloud provider: aws (gcp and azure are planned) | |
| --since | 30 days ago | Billing period start date (YYYY-MM-DD) | |
| --format | plain | Output format: plain, json, table |
AWS authentication
Uses the standard AWS credential chain — no ANNÁVE-specific setup required:
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEYenvironment variables~/.aws/credentialsfile- IAM instance role (when running on EC2 or ECS)
The IAM policy must include ce:GetCostAndUsage and ce:GetCostForecast. Minimum policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ce:GetCostAndUsage",
"ce:GetCostForecast"
],
"Resource": "*"
}
]
}AWS Cost Explorer charges $0.01 per API request. A single annave cost scan run makes 2 requests (usage + forecast).
Anomaly detection
A service is flagged as an anomaly when both conditions are met:
- Its cost on the last day of the period is more than 20% above its 7-day rolling average
- The absolute increase exceeds $5
Both conditions must be met. This filters out noise from services with sub-dollar variance.
Forecast
A 30-day projected total is fetched via GetCostForecast. If the account has fewer than 14 days of billing data, the forecast API returns an error — annave cost scan omits the forecast silently and continues.
Examples
Default 30-day scan
annave cost scanCustom date range
annave cost scan --since 2026-04-01JSON output
annave cost scan --format json | jq '.anomalies'Plain output
Cost analysis — AWS
period 2026-04-16 → 2026-05-15
total cost $1,284.72 USD
scanned at 2026-05-16 10:42:07
forecast (next 30 days) $1,310.00 USD
TOP SERVICES BY COST (12):
Amazon EC2 $ 612.40 ( 47.7%)
Amazon RDS $ 287.15 ( 22.4%)
Amazon S3 $ 156.88 ( 12.2%)
AWS Lambda $ 88.42 ( 6.9%)
Amazon CloudFront $ 62.17 ( 4.8%)
...and 7 more services
ANOMALIES (1):
[1] Amazon RDS — 34% above 7-day average ($28.71/day vs $21.43/day avg)GCP and Azure
--provider gcp and --provider azure print a friendly notice and exit with code 0. They are planned for a future release.
What to watch
- Cost Explorer data has up to 24 hours of latency. Yesterday's costs may not yet be final when you run the command.
- The 7-day rolling average includes the last day of the period, so a new spike on the final day is compared against the prior 7 days.
- Cost Explorer is a global service — region does not affect which data is returned. All costs across all regions are included.
- If your account has cost allocation tags enabled, the per-service grouping reflects tag-based attribution. If not, all costs fall under the AWS service name.