1---2name: cloud-cost-review3description: Review and optimize cloud infrastructure costs — resource utilization analysis, right-sizing, reserved capacity, spot/preemptible usage, and savings recommendations. TRIGGER when: user says /cloud-cost-review, asks to reduce cloud spend, review AWS/GCP/Azure costs, optimize resource utilization, or find cost savings opportunities.4---56# Cloud Cost Review & Optimization78You are a senior cloud architect performing a cost optimization review. Identify waste, recommend right-sizing, and produce an actionable savings plan with estimated impact.910## Process1112### Step 1: Gather Cost Context1314Before reviewing, determine:15- Which cloud provider(s)? (AWS, GCP, Azure, multi-cloud)16- What is the current monthly spend and trend? (growing, stable, declining)17- What are the top cost drivers? (compute, storage, data transfer, managed services)18- What is the environment breakdown? (production, staging, development, sandbox)19- Are there existing Reserved Instances, Savings Plans, or Committed Use Discounts?20- What cost management tools are in use? (Cost Explorer, Billing Console, third-party like Vantage, Kubecost)21- Are there budget alerts configured?2223### Step 2: Analyze Resource Utilization2425| Resource Type | Key Metrics to Review | Right-Sizing Signal | Waste Signal |26|--------------|----------------------|---------------------|-------------|27| **Compute (EC2, GCE, VMs)** | CPU utilization, memory utilization, network I/O | Avg CPU < 20% or > 80% | Avg CPU < 5% for 7+ days |28| **Kubernetes Clusters** | Pod resource requests vs. actual usage, node utilization | Requests > 2x actual usage | Nodes with < 30% allocated |29| **Databases (RDS, CloudSQL)** | CPU, connections, IOPS, storage used vs. provisioned | Provisioned IOPS > 3x actual | Multi-AZ on non-production |30| **Storage (S3, GCS, Blob)** | Access frequency, lifecycle compliance, versioning overhead | Objects not accessed in 90 days | No lifecycle policy, unlimited versioning |31| **Data Transfer** | Cross-AZ, cross-region, internet egress | Significant cross-AZ traffic | Data transfer > 10% of total bill |32| **Load Balancers** | Request count, active connections | LB with < 100 requests/day | Unused LBs (zero traffic) |33| **Managed Services** | Provisioned vs. consumed capacity | Provisioned > 3x peak usage | Services with zero utilization |3435### Step 3: Identify Savings Opportunities3637#### Category 1: Eliminate Waste (Immediate, Low Risk)3839| Opportunity | How to Identify | Typical Savings | Action |40|------------|-----------------|----------------|--------|41| **Idle resources** | Zero or near-zero utilization for 7+ days | 100% of resource cost | Terminate or schedule auto-stop |42| **Unattached volumes** | EBS/PD volumes with no instance attachment | 100% of volume cost | Snapshot and delete |43| **Old snapshots** | Snapshots older than retention policy | Varies, often $100s-$1000s/mo | Delete per policy |44| **Unused Elastic IPs** | Allocated but not associated | $3.65/month each | Release |45| **Oversized dev/staging** | Non-production matching production size | 50-70% of non-prod compute | Downsize non-prod |46| **Unused NAT Gateways** | NAT gateways in VPCs with no active workloads | ~$32/month + data processing | Remove |4748#### Category 2: Right-Size Resources (Short-Term, Low-Medium Risk)4950| Resource | Analysis Method | Recommendation Logic |51|----------|----------------|---------------------|52| **Compute instances** | 14-day CPU/memory P95 | If P95 CPU < 40%, downsize by one tier. If P95 CPU < 10%, downsize by two tiers. |53| **Database instances** | 14-day CPU P95, connection count | If P95 CPU < 30% and connections < 50% max, downsize. Consider Aurora Serverless for variable workloads. |54| **Kubernetes requests** | Compare requests to actual P99 usage | Set requests = P99 actual + 20% buffer. Set limits = 2x requests. |55| **Provisioned IOPS** | Compare provisioned to actual peak IOPS | If peak < 50% provisioned, reduce. Consider gp3 over io1/io2. |56| **Redis/Memcached** | Memory utilization, connection count | If memory usage < 40%, downsize. Consider Serverless ElastiCache. |5758#### Category 3: Commitment Discounts (Medium-Term, Requires Planning)5960| Discount Type | Provider | Discount Range | Commitment | Best For |61|--------------|----------|---------------|------------|----------|62| **Reserved Instances** | AWS, Azure | 30-72% | 1 or 3 years | Stable baseline compute, databases |63| **Savings Plans** | AWS | 20-66% | 1 or 3 years | Flexible compute (any instance family/region) |64| **Committed Use Discounts** | GCP | 37-55% | 1 or 3 years | Stable GCE and GKE workloads |65| **Spot/Preemptible Instances** | All providers | 60-90% | None (can be interrupted) | Stateless workloads, batch processing, CI/CD |66| **Enterprise Discount Program** | AWS, GCP, Azure | 5-20% | Annual spend commitment | Large accounts ($500K+/year) |6768**Commitment Coverage Target:**69- Aim for 70-80% of stable baseline covered by commitments70- Leave 20-30% as on-demand for flexibility and growth71- Never commit to more than your minimum baseline over the commitment period7273#### Category 4: Architecture Optimization (Long-Term, Higher Effort)7475| Optimization | Potential Savings | Implementation Effort | Example |76|-------------|------------------|----------------------|---------|77| **Graviton/ARM migration** | 20-40% on compute | Medium | Migrate compatible workloads to ARM instances |78| **Serverless migration** | 40-80% for variable workloads | High | Move low-traffic APIs from containers to Lambda/Cloud Functions |79| **Storage tiering** | 30-70% on storage | Low-Medium | Move infrequent data to S3 IA/Glacier, GCS Nearline/Coldline |80| **Data transfer optimization** | 20-50% on transfer | Medium | Use VPC endpoints, consolidate cross-AZ traffic, use CDN |81| **Database engine optimization** | 20-50% on database | High | Migrate from licensed DB to open-source, use Aurora Serverless |82| **Container packing** | 20-40% on cluster cost | Medium | Improve bin-packing, use Karpenter/Cluster Autoscaler effectively |8384### Step 4: Build a Savings Plan8586Prioritize recommendations by savings impact and implementation effort:8788| Priority | Criteria | Timeline |89|----------|----------|----------|90| **P0 — Quick Wins** | > $100/month savings, < 1 hour effort, no risk | This week |91| **P1 — Low Hanging Fruit** | > $500/month savings, < 1 day effort, low risk | This sprint |92| **P2 — Right-Sizing** | > $1000/month savings, requires testing | Next 2-4 weeks |93| **P3 — Commitments** | Significant savings, requires approval and planning | Next 1-2 months |94| **P4 — Architecture** | Large savings, significant engineering effort | Next quarter |9596### Step 5: Implement Cost Governance9798| Control | Purpose | Implementation |99|---------|---------|---------------|100| **Budget Alerts** | Detect unexpected spend increases | Set alerts at 50%, 80%, 100% of monthly budget |101| **Tagging Policy** | Attribute costs to teams/services | Require tags: `team`, `service`, `environment`, `cost-center` |102| **Quota/Limits** | Prevent accidental large resource creation | Set account-level quotas for expensive resource types |103| **Scheduled Scaling** | Reduce non-production costs outside business hours | Auto-stop dev/staging instances evenings and weekends |104| **FinOps Reviews** | Regular cost review cadence | Weekly anomaly review, monthly optimization review |105| **Cost Anomaly Detection** | Automated detection of spend spikes | Enable AWS Cost Anomaly Detection or equivalent |106107### Step 6: Measure and Report108109**Key FinOps Metrics:**110111| Metric | Formula | Target |112|--------|---------|--------|113| **Unit Cost** | Total cost / business unit (per user, per request, per GB) | Decreasing over time |114| **Commitment Coverage** | Committed spend / total eligible spend | 70-80% |115| **Waste Ratio** | Identified waste / total spend | < 5% |116| **Cost per Environment** | Spend breakdown by environment | Non-prod < 30% of total |117| **Cost Trend** | Month-over-month spend change | Aligned with business growth |118119## Output Format120121```122## Cloud Cost Review: [Account/Project Name]123124### Current Spend Summary125[Monthly spend, trend, top 5 cost drivers]126127### Waste Identified128[Table of idle/unused resources with monthly cost]129130### Right-Sizing Recommendations131[Table of resources to resize with current vs. recommended and savings]132133### Commitment Opportunities134[RI/SP/CUD recommendations with discount and payback period]135136### Architecture Optimizations137[Longer-term optimization opportunities]138139### Savings Summary140| Category | Monthly Savings | Annual Savings | Effort |141|----------|----------------|---------------|--------|142| Waste elimination | $X | $X | Low |143| Right-sizing | $X | $X | Medium |144| Commitments | $X | $X | Low |145| Architecture | $X | $X | High |146| **Total** | **$X** | **$X** | |147148### Implementation Roadmap149[Prioritized action items with owners and timelines]150151### Governance Recommendations152[Tagging, budgets, alerts, review cadence]153```154155## Quality Checklist156157- [ ] All major resource types reviewed (compute, storage, database, network, managed services)158- [ ] Utilization data covers at least 14 days (longer for commitment decisions)159- [ ] Non-production environments reviewed separately from production160- [ ] Savings estimates are conservative (use lower bound)161- [ ] Right-sizing recommendations include a rollback plan162- [ ] Commitment recommendations do not exceed minimum baseline usage163- [ ] Tagging policy covers cost attribution to teams and services164- [ ] Budget alerts are configured with appropriate thresholds165- [ ] Recommendations include effort estimate and risk level166- [ ] Unit economics (cost per user/request) are tracked alongside absolute costs167168## Edge Cases169170- **Multi-Account / Organization:** Review consolidated billing for cross-account RI/SP sharing. Ensure discount benefits are attributed to the correct team. Check for orphaned accounts with active resources.171- **Kubernetes Cost Attribution:** Use Kubecost, OpenCost, or provider-native tools to attribute cluster costs to namespaces/teams. Container right-sizing requires pod-level metrics, not just node-level.172- **Data Transfer Costs:** Often hidden and significant. Map data flows between services, regions, and to the internet. Use VPC endpoints for AWS service traffic. Consider CDN for egress-heavy workloads.173- **Spot Instance Management:** Use mixed instance policies with multiple instance types. Implement graceful shutdown handling. Never run stateful or single-instance workloads on spot. Use spot for CI/CD runners, batch jobs, and horizontal scale-out tiers.174- **Licensing Costs:** Windows and commercial database licenses add significant cost. Consider BYOL (Bring Your Own License) or migration to open-source alternatives. Factor license costs into right-sizing decisions.175- **Growth Planning:** Do not optimize for today's usage if a launch or traffic increase is planned within the commitment window. Use Savings Plans (flexible) over Reserved Instances (rigid) when growth is uncertain.