Optimize AWS costs through resource rightsizing and savings strategies
Analyzes AWS usage to identify cost optimization opportunities across EC2, RDS, and S3. Triggers when users request cost reduction strategies or review spending.
/plugin marketplace add pluginagentmarketplace/custom-plugin-aws/plugin install pluginagentmarketplace-aws-cloud-assistant@pluginagentmarketplace/custom-plugin-awsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/cost-checklist.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyReduce AWS spending while maintaining performance and reliability.
| Attribute | Value |
|---|---|
| AWS Services | Cost Explorer, Budgets, Trusted Advisor |
| Complexity | Medium |
| Est. Time | 30-60 min analysis |
| Prerequisites | Cost & Usage Reports access |
| Parameter | Type | Description | Validation |
|---|---|---|---|
| time_period | string | Analysis period | last_30_days, last_90_days |
| scope | array | Service types | ["EC2", "RDS", "S3"] |
| Parameter | Type | Default | Description |
|---|---|---|---|
| savings_target | float | 20 | Target savings % |
| include_recommendations | bool | true | Include AWS recommendations |
| tag_filter | object | {} | Filter by tags |
┌─────────────────────────────────────────────────────────┐
│ COST OPTIMIZATION │
├─────────────────────────────────────────────────────────┤
│ 1. RIGHT SIZE │ Match resources to actual usage │
│ 2. SAVINGS PLANS │ Commit for 30-72% savings │
│ 3. SPOT/RESERVED │ Use discount pricing models │
│ 4. STORAGE TIER │ Move data to cheaper storage │
│ 5. CLEANUP │ Remove unused resources │
└─────────────────────────────────────────────────────────┘
| Strategy | Effort | Savings |
|---|---|---|
| Right-sizing | Low | 10-50% |
| Graviton (arm64) | Medium | 40% |
| Spot Instances | Medium | 60-90% |
| Savings Plans | Low | 30-72% |
| Reserved Instances | Low | 30-60% |
| Scheduled scaling | Medium | 20-40% |
| Strategy | Effort | Savings |
|---|---|---|
| Right-sizing | Low | 10-40% |
| Reserved Instances | Low | 30-60% |
| Aurora Serverless | Medium | Variable |
| Multi-AZ review | Low | 50% (if not needed) |
| Storage optimization | Low | 10-30% |
| Strategy | Effort | Savings |
|---|---|---|
| Intelligent-Tiering | Low | 20-40% |
| Lifecycle policies | Low | 40-80% |
| Glacier transition | Low | 80-95% |
| Cleanup old versions | Low | 10-30% |
| Compression | Medium | 20-50% |
# Get cost by service
aws ce get-cost-and-usage \
--time-period Start=2024-01-01,End=2024-01-31 \
--granularity MONTHLY \
--metrics BlendedCost \
--group-by Type=DIMENSION,Key=SERVICE
# Get rightsizing recommendations
aws ce get-rightsizing-recommendation \
--service EC2 \
--configuration '{
"RecommendationTarget": "SAME_INSTANCE_FAMILY",
"BenefitsConsidered": true
}'
aws budgets create-budget \
--account-id 123456789012 \
--budget '{
"BudgetName": "Monthly-Total",
"BudgetLimit": {"Amount": "1000", "Unit": "USD"},
"TimeUnit": "MONTHLY",
"BudgetType": "COST"
}' \
--notifications-with-subscribers '[{
"Notification": {
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [{
"SubscriptionType": "EMAIL",
"Address": "alerts@company.com"
}]
}]'
# Get Savings Plans recommendations
aws ce get-savings-plans-purchase-recommendation \
--savings-plans-type COMPUTE_SP \
--term-in-years ONE_YEAR \
--payment-option NO_UPFRONT \
--lookback-period-in-days SIXTY_DAYS
| Symptom | Cause | Solution |
|---|---|---|
| Unexpected costs | Unused resources | Enable Cost Anomaly Detection |
| Data transfer spike | Cross-region/AZ | Use VPC endpoints |
| Storage growth | No lifecycle rules | Implement policies |
| NAT Gateway costs | Heavy outbound | Use VPC endpoints |
aws ce create-anomaly-monitor \
--anomaly-monitor '{
"MonitorName": "cost-anomalies",
"MonitorType": "DIMENSIONAL",
"MonitorDimension": "SERVICE"
}'
aws ce create-anomaly-subscription \
--anomaly-subscription '{
"SubscriptionName": "alert-subscription",
"MonitorArnList": ["arn:aws:ce::...:anomalymonitor/..."],
"Subscribers": [{
"Type": "EMAIL",
"Address": "alerts@company.com"
}],
"Threshold": 100
}'
weekly:
- Check Cost Anomaly alerts
- Review Trusted Advisor recommendations
monthly:
- Run rightsizing analysis
- Review Savings Plans utilization
- Check Reserved Instance coverage
- Analyze data transfer costs
- Clean up unused resources
quarterly:
- Evaluate Savings Plans purchase
- Architecture optimization review
- Tag compliance audit
def test_cost_optimization_compliance():
# Check for unattached EBS volumes
volumes = ec2.describe_volumes(
Filters=[{'Name': 'status', 'Values': ['available']}]
)
assert len(volumes['Volumes']) == 0, "Unattached EBS volumes found"
# Check for unused Elastic IPs
addresses = ec2.describe_addresses()
unattached = [a for a in addresses['Addresses'] if 'InstanceId' not in a]
assert len(unattached) == 0, "Unused Elastic IPs found"
assets/cost-checklist.yaml - Cost optimization checklistThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.