Analyze and optimize cloud costs across AWS, Azure, GCP with rightsizing, reserved instances, waste detection, and FinOps best practices.
Primary trigger conditions:
When NOT to use this skill:
Value proposition: Identifies 30-40% of typical cloud waste through systematic analysis of rightsizing, commitment discounts, and idle resources using FinOps principles.
Required inputs validation:
NOW_ET = "2025-10-25T22:42:30-04:00"
assert cloud_provider in ["aws", "azure", "gcp", "multi"], "Invalid cloud provider"
assert cost_data_source is not None, "Cost data source required"
assert time_range in ["7d", "30d", "90d"] or matches_custom_format(time_range)
assert len(optimization_targets) > 0, "At least one optimization target required"
# Data freshness check
if cost_data_age > 24h:
warn("Cost data is stale; recommendations may be outdated")
# Minimum data volume check
if time_range == "7d" and total_resources < 10:
suggest("Use 30d+ range for better trend analysis")
Authority checks:
ce:GetCostAndUsage permissionbilling.accounts.getSpendingInformation permissionSource citations (accessed 2025-10-25T22:42:30-04:00):
Goal: Identify top 3 cost optimization opportunities in <5 minutes.
Steps:
Fetch cost summary for specified time_range
Quick waste scan (top offenders only)
Commitment coverage check
Output quick wins (3 highest impact items)
Token budget checkpoint: ~1.5k tokens for API calls, analysis, and output formatting.
Goal: Generate detailed, actionable cost optimization plan with quantified savings.
Extends T1 with:
Rightsizing analysis
(current_price - recommended_price) * hours_per_monthReserved instance / Savings plan optimization
upfront_cost / monthly_savingsStorage optimization
(current_storage_cost - optimized_cost) * TB_storedNetwork cost optimization
Cost anomaly detection
FinOps maturity assessment (basic)
Authority sources (accessed 2025-10-25T22:42:30-04:00):
Output: JSON report with sections: cost_summary, quick_wins (T1), rightsizing_recommendations, commitment_recommendations, storage_optimization, network_optimization, anomalies, finops_maturity_score.
Token budget checkpoint: ~5k tokens (includes T1 + extended analysis + detailed output).
Reserved for future enhancements: predictive cost forecasting, ML-based anomaly detection, multi-account/org-wide consolidation, custom FinOps policies.
When to abort:
Ambiguity thresholds:
Prioritization logic:
savings_per_month / implementation_effort
FinOps principle application (accessed 2025-10-25T22:42:30-04:00):
Per FinOps Foundation principles (https://www.finops.org/framework/principles/):
Schema (JSON):
{
"cost_analysis_report": {
"period": "2025-09-25 to 2025-10-25",
"cloud_provider": "aws",
"total_spend": 47500.32,
"waste_identified": 14250.10,
"savings_potential": {
"monthly": 12800.00,
"annual": 153600.00,
"percentage": 26.9
}
},
"quick_wins": [
{
"category": "unused_resources",
"description": "Delete 12 unattached EBS volumes",
"monthly_savings": 360.00,
"implementation_effort": "low",
"risk_level": "none"
}
],
"rightsizing_recommendations": [
{
"resource_id": "i-0a1b2c3d4e5f6g7h8",
"resource_type": "ec2_instance",
"current_type": "m5.2xlarge",
"recommended_type": "m5.xlarge",
"utilization_avg": 18.5,
"monthly_savings": 150.00,
"confidence": "high"
}
],
"commitment_recommendations": [
{
"service": "ec2_compute",
"plan_type": "compute_savings_plan",
"term": "3_year",
"upfront": "partial",
"monthly_commitment": 5000.00,
"monthly_savings": 1200.00,
"break_even_months": 4.2
}
],
"waste_inventory": [
{
"resource_id": "vol-0123456789abcdef",
"type": "ebs_volume_unattached",
"idle_days": 45,
"monthly_cost": 30.00
}
],
"action_plan": [
{
"priority": 1,
"action": "Delete unused resources",
"impact": "high",
"effort": "low",
"items_count": 27,
"monthly_savings": 810.00
}
]
}
Required fields: cost_analysis_report (with total_spend, savings_potential), action_plan (prioritized).
Optional fields: rightsizing_recommendations, commitment_recommendations (only if applicable).
# Example: AWS cost optimization for over-provisioned workload