Analyzes and reduces AWS spend with Cost Explorer, Budgets, Compute Optimizer, and Cost Optimization Hub CLI queries.
Agentic Workflow: Read -> Reason -> Act (cost-aws)
You are Cost Aws (finops/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — finops context for cost-aws
- Domain: Analyzes and reduces AWS spend with Cost Explorer, Budgets, Compute Optimizer, and Cost Optimization Hub CLI queries.
- cost-explorer: Query AWS cost and usage data, forecasts, and reservations via the ce API. —
aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granul
- optimization: Find rightsizing and cost optimization recommendations. —
aws cost-optimization-hub list-recommendations --category Compute
- Check
knowledge and prerequisites: aws
2. Reason — think for cost-aws
- For
cost-explorer: Query AWS cost and usage data, forecasts, and reservations via the ce API. — decide which checks to run
- For
optimization: Find rightsizing and cost optimization recommendations. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with cost-aws tools
- Tools:
Glob, Grep, Read, Aws (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
cost-aws:3164efd3
AWS Cost Optimization
Find and eliminate AWS waste using native Cost Explorer and optimization APIs.
When to Use
- Monthly cost review by service or team
- Detecting spend anomalies before they compound
- Rightsizing EC2, RDS, and EBS resources
- Validating reservations and Savings Plans coverage
Cost exploration
aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE
Group by Type=TAG,Key=team when your org enforces cost-allocation tags.
Find savings
aws cost-optimization-hub list-recommendations --category Compute
aws compute-optimizer get-ec2-instance-recommendations
Rightsize only after 14 days of steady-state utilization data; avoid churning on bursty jobs.
Budgets and alerts
aws budgets create-budget --account-id 123456789012 --budget file://budget.json --notifications-with-subscribers file://notifications.json
Budget JSON example:
{
"BudgetLimit": {"Amount": "10000", "Unit": "USD"},
"BudgetName": "monthly-engineering",
"BudgetType": "COST",
"TimeUnit": "MONTHLY",
"TimePeriod": {"Start": "2026-08-01"}
}
Anomaly detection
aws ce get-anomalies --monitor-arn <monitor-arn> --date-interval Start=2026-07-01
aws ce get-anomaly-monitors
Best practices
- Tag everything; untagged resources are invisible to owners.
- Use Savings Plans for steady compute and Spot for interruptible work.
- Archive old S3 objects with lifecycle policies before buying more storage.
- Review the weekly cost anomaly report and close monitors with known reasons.
Capabilities
cost-explorer
Query AWS cost and usage data, forecasts, and reservations via the ce API.
Parameters:
time-period (string): Start and end dates in YYYY-MM-DD format
granularity (string): DAILY, MONTHLY, or HOURLY aggregation
metrics (string): Metrics like UnblendedCost, BlendedCost, UsageQuantity
Commands:
aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity MONTHLY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE
aws ce get-cost-forecast --time-period Start=2026-08-01,End=2026-09-01 --metric UNBLENDED_COST --granularity MONTHLY
aws ce get-reservation-coverage --time-period Start=2026-07-01,End=2026-08-01
aws ce get-reservation-utilization --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY
aws ce get-anomalies --monitor-arn arn:aws:ce::123456789012:anomalymonitor/abc --date-interval Start=2026-07-01
Examples:
- aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY --metrics UnblendedCost --group-by Type=TAG,Key=team
- aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity MONTHLY --metrics UnblendedCost --filter '{"Dimensions":{"Key":"SERVICE","Values":["Amazon Simple Storage Service"]}}'
- aws ce get-cost-forecast --metric UNBLENDED_COST --granularity DAILY
optimization
Find rightsizing and cost optimization recommendations.
Parameters:
category (string): Optimization category: Compute, Storage, License
account-ids (string): AWS account id list to scan
implementation-effort (string): Low, Medium, High effort filter for recommendations
Commands:
aws cost-optimization-hub list-recommendations --category Compute
aws compute-optimizer get-ec2-instance-recommendations --account-ids 123456789012
aws compute-optimizer get-ebs-volume-recommendations --account-ids 123456789012
aws savingsplans list-savings-plans
aws budgets describe-budgets --account-id 123456789012
Examples:
- aws cost-optimization-hub list-recommendations --category Storage --implementation-effort High | jq '.items[] | {resourceId, estimatedSavings}'
- aws compute-optimizer get-ec2-instance-recommendations | jq '.instanceRecommendations[] | {instanceArn, finding}'
- aws budgets describe-budgets --account-id 123456789012 --budget-type COST
References
1---2name: "cost-aws"3description: "Analyzes and reduces AWS spend with Cost Explorer, Budgets, Compute Optimizer, and Cost Optimization Hub CLI queries. Use when working with cost explorer, optimization, cost aws or when the user mentions cost explorer, optimization, cost aws."4license: "MIT"5compatibility: "Requires aws."6metadata:7 source: https://skillmd.com/skills/opknock/cost-aws8 author: Kdesk9 version: 2.0.010 category: finops11allowed-tools: "Glob Grep Read Bash(aws:*)"12---1314Analyzes and reduces AWS spend with Cost Explorer, Budgets, Compute Optimizer, and Cost Optimization Hub CLI queries.1516## Agentic Workflow: Read -> Reason -> Act (cost-aws)1718You are **Cost Aws** (finops/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — finops context for `cost-aws`21- Domain: Analyzes and reduces AWS spend with Cost Explorer, Budgets, Compute Optimizer, and Cost Optimization Hub CLI queries.22- **cost-explorer**: Query AWS cost and usage data, forecasts, and reservations via the ce API. — `aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granul`23- **optimization**: Find rightsizing and cost optimization recommendations. — `aws cost-optimization-hub list-recommendations --category Compute`24- Check `knowledge` and `prerequisites: aws`2526### 2. Reason — think for `cost-aws`27- For `cost-explorer`: Query AWS cost and usage data, forecasts, and reservations via the ce API. — decide which checks to run28- For `optimization`: Find rightsizing and cost optimization recommendations. — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `cost-aws` tools32- Tools: `Glob`, `Grep`, `Read`, `Aws` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `cost-aws:3164efd3`3536# AWS Cost Optimization3738Find and eliminate AWS waste using native Cost Explorer and optimization APIs.3940## When to Use4142- Monthly cost review by service or team43- Detecting spend anomalies before they compound44- Rightsizing EC2, RDS, and EBS resources45- Validating reservations and Savings Plans coverage4647## Cost exploration4849```bash50aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE51```5253Group by `Type=TAG,Key=team` when your org enforces cost-allocation tags.5455## Find savings5657```bash58aws cost-optimization-hub list-recommendations --category Compute59aws compute-optimizer get-ec2-instance-recommendations60```6162Rightsize only after 14 days of steady-state utilization data; avoid churning on bursty jobs.6364## Budgets and alerts6566```bash67aws budgets create-budget --account-id 123456789012 --budget file://budget.json --notifications-with-subscribers file://notifications.json68```6970Budget JSON example:7172```json73{74 "BudgetLimit": {"Amount": "10000", "Unit": "USD"},75 "BudgetName": "monthly-engineering",76 "BudgetType": "COST",77 "TimeUnit": "MONTHLY",78 "TimePeriod": {"Start": "2026-08-01"}79}80```8182## Anomaly detection8384```bash85aws ce get-anomalies --monitor-arn <monitor-arn> --date-interval Start=2026-07-0186aws ce get-anomaly-monitors87```8889## Best practices9091- Tag everything; untagged resources are invisible to owners.92- Use Savings Plans for steady compute and Spot for interruptible work.93- Archive old S3 objects with lifecycle policies before buying more storage.94- Review the weekly cost anomaly report and close monitors with known reasons.9596## Capabilities9798### cost-explorer99Query AWS cost and usage data, forecasts, and reservations via the ce API.100101**Parameters:**102- `time-period` (string): Start and end dates in YYYY-MM-DD format103- `granularity` (string): DAILY, MONTHLY, or HOURLY aggregation104- `metrics` (string): Metrics like UnblendedCost, BlendedCost, UsageQuantity105106**Commands:**107- `aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity MONTHLY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE`108- `aws ce get-cost-forecast --time-period Start=2026-08-01,End=2026-09-01 --metric UNBLENDED_COST --granularity MONTHLY`109- `aws ce get-reservation-coverage --time-period Start=2026-07-01,End=2026-08-01`110- `aws ce get-reservation-utilization --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY`111- `aws ce get-anomalies --monitor-arn arn:aws:ce::123456789012:anomalymonitor/abc --date-interval Start=2026-07-01`112113**Examples:**114- aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity DAILY --metrics UnblendedCost --group-by Type=TAG,Key=team115- aws ce get-cost-and-usage --time-period Start=2026-07-01,End=2026-08-01 --granularity MONTHLY --metrics UnblendedCost --filter '{"Dimensions":{"Key":"SERVICE","Values":["Amazon Simple Storage Service"]}}'116- aws ce get-cost-forecast --metric UNBLENDED_COST --granularity DAILY117118### optimization119Find rightsizing and cost optimization recommendations.120121**Parameters:**122- `category` (string): Optimization category: Compute, Storage, License123- `account-ids` (string): AWS account id list to scan124- `implementation-effort` (string): Low, Medium, High effort filter for recommendations125126**Commands:**127- `aws cost-optimization-hub list-recommendations --category Compute`128- `aws compute-optimizer get-ec2-instance-recommendations --account-ids 123456789012`129- `aws compute-optimizer get-ebs-volume-recommendations --account-ids 123456789012`130- `aws savingsplans list-savings-plans`131- `aws budgets describe-budgets --account-id 123456789012`132133**Examples:**134- aws cost-optimization-hub list-recommendations --category Storage --implementation-effort High | jq '.items[] | {resourceId, estimatedSavings}'135- aws compute-optimizer get-ec2-instance-recommendations | jq '.instanceRecommendations[] | {instanceArn, finding}'136- aws budgets describe-budgets --account-id 123456789012 --budget-type COST137138## References139- [AWS Cost Management Docs](https://docs.aws.amazon.com/cost-management/)140- [Compute Optimizer](https://docs.aws.amazon.com/compute-optimizer/)141- [Cost Optimization Hub](https://docs.aws.amazon.com/aws-cost-management/latest/userguide/cost-optimization-hub.html)