aws-cost-watcher
Purpose
Daily AWS spend anomaly watcher with Bedrock cost correlation.
Runbook
- Run
scripts/fetch.shto pull daily cost data from AWS Cost Explorer (last 14 days by default). - The script compares each day of spend against the trailing 7-day rolling average to detect anomalies.
- Flag a day as anomalous if spend is greater than
1.5×the rolling average. - Correlate with Bedrock API spend if the active AWS profile can see the
Amazon Bedrockservice line item. - Run
scripts/alert.shif any anomalous day is found; it sends a formatted alert toALERT_WEBHOOK_URL. - Always produce a local report via
scripts/report.shregardless of alert status.
Stop conditions
- Abort if
awsCLI is not configured (aws sts get-caller-identityfails). - Abort if
AWS_REGIONis not set. - Do not send alerts if
ALERT_WEBHOOK_URLis not set; log a warning and continue. - Abort live collection if the Cost Explorer API returns an access denied error.
Output format
cost-report.json— daily costs per service for the lookback window- Console: markdown table of spend per day, anomaly flags, and Bedrock spend
- Alert payload: JSON posted to
ALERT_WEBHOOK_URL
Example invocations
bash skills/aws-cost-watcher/scripts/fetch.shbash skills/aws-cost-watcher/scripts/fetch.sh --days 30bash skills/aws-cost-watcher/scripts/alert.sh cost-report.jsonbash skills/aws-cost-watcher/scripts/report.sh- "Show me my AWS spend anomalies for the past two weeks."