| name | optimizing-cloud-costs |
| description | Execute use when you need to work with cloud cost optimization.
This skill provides cost analysis and optimization with comprehensive guidance and automation.
Trigger with phrases like "optimize costs", "analyze spending",
or "reduce costs".
|
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash(aws:*), Bash(gcloud:*), Bash(az:*) |
| version | 1.27.0 |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| license | MIT |
| tags | ["devops","cost-optimization","optimizing-cloud"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Optimizing Cloud Costs
Overview
Analyze cloud spending across AWS, GCP, and Azure to identify waste, recommend rightsizing, and generate cost-saving configurations. Covers reserved instances, spot/preemptible workloads, storage tiering, idle resource cleanup, and budget alerting using cloud-native cost management APIs.
Prerequisites
- Cloud provider CLI authenticated with billing/cost-explorer read access
- AWS:
ce:GetCostAndUsage, ec2:DescribeInstances, cloudwatch:GetMetricData permissions
- GCP: Billing Account Viewer and Compute Viewer roles
- Azure: Cost Management Reader role
- Access to current infrastructure-as-code (Terraform, CloudFormation) for rightsizing changes
- At least 30 days of billing data for meaningful analysis
Instructions
- Pull current cost data using cloud cost APIs (
aws ce get-cost-and-usage, gcloud billing budgets list)
- Identify the top 10 cost drivers by service, region, and resource tag
- Detect idle resources: instances with < 5% average CPU over 14 days, unattached EBS volumes, unused Elastic IPs, orphaned snapshots
- Recommend rightsizing: compare instance utilization against available instance types and suggest downsizing
- Evaluate reserved instance or savings plan coverage against on-demand spend; recommend commitments for steady-state workloads
- Identify spot/preemptible candidates: stateless, fault-tolerant workloads (batch jobs, CI runners, dev environments)
- Review storage costs: recommend S3 Intelligent-Tiering, lifecycle policies for infrequent access, or Glacier for archives
- Generate Terraform/IaC changes to implement approved optimizations
- Set up budget alerts with thresholds at 50%, 80%, and 100% of monthly budget
- Create a cost optimization report summarizing findings, savings estimates, and implementation priority
Output
- Cost analysis report with per-service breakdown and savings recommendations
- Terraform/CloudFormation changes for rightsizing and reserved instance purchases
- S3 lifecycle policy configurations for storage tiering
- Budget alert configurations (CloudWatch, GCP Budget, Azure Cost Alerts)
- Cleanup scripts for idle resources (with dry-run mode for safety)
Error Handling
| Error | Cause | Solution |
|---|
Access Denied on Cost Explorer API |