| name | aws-cost-optimizer |
| description | Analyze AWS costs, find waste, and recommend optimizations using read-only MCP tools |
| version | 1.0.0 |
| author | kai-agent |
| metadata | {"kai":{"tags":["kai","aws","cost","optimization","finops"],"related_skills":["aws-performance"]}} |
AWS Cost Optimizer
Analyze AWS spending, identify waste, and recommend cost optimizations.
All operations are read-only — no changes are made to infrastructure.
Prerequisites
- Workspace with AWS credentials configured in kai-backend
- MCP tools available:
mcp__kai__aws_*
Workflow 1: Quick Cost Check
Get a snapshot of current spending and trend.
-
Get last 30 days of costs:
aws_cost_summary(workspaceId, startDate="YYYY-MM-DD", endDate="YYYY-MM-DD")
- Identify top 5 spending services
- Note total monthly spend
-
Forecast next 30 days:
aws_cost_forecast(workspaceId, startDate="today", endDate="+30d", granularity="MONTHLY")
- Compare with current spend
- Flag if forecast shows >10% increase
-
Present findings as a table:
| Service | Last 30d | Forecast | Trend |
|---|
Workflow 2: Find Waste
Systematically identify unused/idle resources.
-
Unused EBS volumes (easy win):
aws_ec2_unused_volumes(workspaceId)
Each unattached volume costs money. Calculate: size_gb * $0.10/month
-
Unattached Elastic IPs:
aws_ec2_unattached_eips(workspaceId)
Each costs ~$3.65/month
-
Idle EC2 instances (biggest savings potential):
aws_ec2_list_instances(workspaceId, state="running")
Then for each instance, check CPU over 7 days:
aws_cloudwatch_get_metrics(
workspaceId, namespace="AWS/EC2", metricName="CPUUtilization",
dimensions=[{"name":"InstanceId","value":"i-xxx"}],
startTime="-7d", endTime="now", period=3600, statistics=["Average"]
)
- Flag instances with avg CPU < 10% as "idle — consider downsizing or stopping"
- Flag instances with avg CPU < 2% as "likely unused — consider terminating"
-
Oversized Lambda functions:
aws_lambda_list_functions(workspaceId)
Then check actual duration vs configured memory:
aws_cloudwatch_get_metrics(
workspaceId, namespace="AWS/Lambda", metricName="Duration",
dimensions=[{"name":"FunctionName","value":"xxx"}],
startTime="-7d", endTime="now", period=86400, statistics=["Average","Maximum"]
)
- If avg duration < 100ms but memory > 512MB, suggest reducing memory
Workflow 3: Coverage Analysis
Find gaps in Reserved Instances / Savings Plans.
-
RI coverage:
aws_reservation_coverage(workspaceId, startDate="-30d", endDate="today")
- Identify services running >80% on-demand
- Calculate potential savings with 1-year no-upfront RI
-
Savings Plans coverage:
aws_savings_plans_coverage(workspaceId, startDate="-30d", endDate="today")
Workflow 4: S3 Cost Optimization
-
List all buckets:
aws_s3_list_buckets(workspaceId)
-
Analyze each significant bucket:
aws_s3_bucket_analysis(workspaceId, bucketName="xxx")
- Flag buckets without lifecycle rules (data never expires)
- Flag buckets without versioning cleanup (old versions accumulate)
- Recommend Intelligent-Tiering for infrequently accessed data
Reporting Format
Present findings as:
Cost Optimization Report
Current monthly spend: $X,XXX
Estimated monthly savings: $XXX (X%)
| Finding | Service | Monthly Cost | Savings | Severity |
|---|
| 5 unused EBS volumes | EC2 | $50 | $50 | Low |
| 3 idle instances (CPU <5%) | EC2 | $450 | $300 | High |
| No lifecycle rules on logs bucket | S3 | $200 | $150 | Medium |
Recommendations (by impact):
- ...
- ...
Rules
- Always be specific with dollar amounts — use actual data, not estimates
- Never recommend changes without showing the supporting metrics
- Group findings by severity: Critical (>$500/mo), High ($100-500), Medium ($20-100), Low (<$20)
- If a resource has tags suggesting it's intentionally running (e.g., "environment=production"), note that before recommending termination