aws-billing-and-cost-management
Analyze AWS costs, find savings, manage budgets, evaluate Savings Plans and Reserved Instances, right-size EC2/Lambda/RDS/EBS with Compute Optimizer, look up service pricing, query CUR with Athena, detect cost anomalies, scope costs to billing views, and monitor Free Tier usage. Triggers on: AWS bill, cost analysis, reduce spend, savings plan, reserved instance, right-size, budget alert, cost optimization, pricing, free tier, cost anomaly, CUR, cost audit, billing view, billing view ARN.
Security Assessment
About aws-billing-and-cost-management
Analyzes, optimizes, and manages AWS costs, encoding domain expertise from AWS's cost management products including common gotchas, correct API usage patterns, and optimization workflows. It is used for analyzing spending and cost trends, setting up budget alerts, evaluating Savings Plans and Reserved Instances, right-sizing EC2, Lambda, RDS, and EBS resources with Compute Optimizer, looking up service pricing, running cost audits or investigating spikes, querying CUR data with Athena, scoping analysis to a billing view, and checking Free Tier usage. Core concepts span Cost Explorer, Budgets, Billing Views, Compute Optimizer, the Cost Optimization Hub, Savings Plans and Reserved Instances, and CUR 2.0 queried via Athena. The AWS MCP server is the recommended setup for sandboxed execution and audit logging, but commands also work with any agent that has standard AWS CLI access.
Two critical rules are emphasized. The current date must be determined with a tool before any Cost Explorer, Budgets, or Savings Plans call, because models frequently default to training-data years and analyze stale data. Numerical calculations such as sums, averages, percentages, comparisons, and counts must never be reasoned out in the response and must always be done with a script or calculator tool, since LLM arithmetic on cost data is unreliable.
A decision guide routes each question to the right tool and reference file, and a common-tasks section gives concrete commands. Costs by service are analyzed with aws ce get-cost-and-usage grouped by SERVICE, defaulting to UnblendedCost, excluding Credits and Refunds via a RECORD_TYPE filter, and treating the end date as exclusive. Compute Optimizer requires opt-in via update-enrollment-status with status Active. A Billing Views section explains scoping cost data to a slice of billing by adding --billing-view-arn to supported calls, lists billing views with aws billing list-billing-views, and shows including BillingViewArn in a budget JSON, along with a table of which Cost Explorer APIs do and do not support the billing-view ARN. A troubleshooting table maps errors such as ValidationException from a wrong dimension key, empty filtered results, AccessDenied on hourly data, and the Budgets requirement to run in us-east-1 to their fixes.
FAQ
Why must I check the current date before making cost API calls?
LLMs frequently default to dates from their training data instead of the actual current date, producing analyses of stale data that look correct but are wrong. A tool must be used to determine the current date before any Cost Explorer, Budgets, or Savings Plans call.
How should numerical calculations on cost data be done?
Never by reasoning in the response. Sums, averages, percentages, comparisons, counts, and min or max must always be computed with a script or calculator tool, such as a Python script that prints the result, because LLM arithmetic is unreliable on cost data.
How do I scope cost analysis to a specific billing view?
Add --billing-view-arn to supported API calls and discover available views with aws billing list-billing-views (requires the billing:ListBillingViews permission). Supported calls include ce get-cost-and-usage and get-cost-forecast, while reservation and savings-plans coverage and utilization calls do not support it.
What setup does Compute Optimizer require?
It requires opt-in first by running aws compute-optimizer update-enrollment-status with status Active. Without enrollment, calls fail with an Account not registered error.
Why might a Budgets API call fail outside us-east-1?
The Budgets API requires the us-east-1 region. The troubleshooting guidance is to set the region to us-east-1 for Budgets calls.
All Files
16 filesInstall aws-billing-and-cost-management
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
aws/agent-toolkit-for-aws