/cloud:cost-alertfrom cloud
Monitors cloud costs across AWS, GCP, and Azure with anomaly detection, budget tracking, and multi-channel alerting. Supports threshold, trend, and ML-based detection methods.
Claude never picks this command on its own
Claude Code cannot parse its frontmatter, so it ignores every field there: the description on this page is for you to read, but Claude never sees it. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /cloud:cost-alert still runs it.
Monitor and alert on cloud costs across AWS, GCP, and Azure with anomaly detection, budget tracking, and multi-channel notifications.
Comprehensive cloud cost monitoring and alerting solution that:
Query Context7 first: see .claude/rules/context7-required.md. Libraries: aws, gcp, azure, prometheus, grafana.
Query Context7 for provider-specific billing API patterns, then:
AWS Cost Explorer:
// Fetch AWS costs using Cost Explorer API
const costs = await fetchAWSCosts({
timePeriod: { start: '2025-10-01', end: '2025-10-21' },
granularity: 'DAILY',
metrics: ['UnblendedCost', 'UsageQuantity'],
groupBy: [{ type: 'DIMENSION', key: 'SERVICE' }]
});
GCP Cloud Billing:
// Fetch GCP costs using Cloud Billing API
const costs = await fetchGCPCosts({
projectId: 'my-project',
timeRange: { startTime: '2025-10-01', endTime: '2025-10-21' },
aggregation: { groupByFields: ['service', 'sku'] }
});
Azure Cost Management:
// Fetch Azure costs using Cost Management API
const costs = await fetchAzureCosts({
scope: '/subscriptions/{subscription-id}',
timePeriod: { from: '2025-10-01', to: '2025-10-21' },
granularity: 'Daily',
aggregation: { totalCost: 'Sum' }
});
Implement three detection methods:
Threshold-based Detection:
Trend-based Detection:
ML-based Detection:
Budget Monitoring:
// Track budget utilization
const budgetStatus = await trackBudget({
budgetName: 'Q4-2025-Production',
budgetAmount: 50000,
budgetPeriod: 'QUARTERLY',
actualSpend: currentCosts,
forecastedSpend: forecastCosts(historicalData, periodsAhead)
});
// Alert when:
// - 50% budget consumed
// - 80% budget consumed
// - 100% budget exceeded
// - Forecast exceeds budget
Cost Forecasting:
Slack Integration:
// Send Slack alert
await sendSlackAlert({
webhookUrl: process.env.SLACK_WEBHOOK_URL,
channel: '#cloud-costs',
severity: 'warning',
message: {
title: 'AWS Cost Alert: Threshold Exceeded',
cost: '$1,234.56',
threshold: '$1,000.00',
provider: 'AWS',
period: 'Daily',
details: topSpenders
}
});
Email Alerts:
// Send email via SES/SendGrid/Gmail
await sendEmailAlert({
to: ['[email protected]', '[email protected]'],
subject: 'GCP Cost Alert: Budget 80% Consumed',
template: 'cost-alert',
data: { budget, actual, forecast, recommendations }
});
PagerDuty Integration:
// Create PagerDuty incident for critical alerts
await sendPagerDutyAlert({
routingKey: process.env.PAGERDUTY_KEY,
severity: 'critical',
summary: 'Azure costs exceeded critical threshold',
dedup_key: 'azure-cost-alert-2025-10-21',
custom_details: { cost, threshold, resources }
});
Webhook Alerts:
// Send to custom webhook endpoint
await sendWebhookAlert({
url: 'https://api.company.com/cost-alerts',
method: 'POST',
body: {
provider: 'AWS',
alert_type: 'threshold_exceeded',
severity: 'high',
current_cost: 1234.56,
threshold: 1000.00,
timestamp: new Date().toISOString()
}
});
Analyze costs by:
Service/Resource Group:
// AWS: Group by service
const byService = groupCosts(costs, 'SERVICE');
// Top 5: EC2, RDS, S3, Lambda, CloudFront
// GCP: Group by service
const byService = groupCosts(costs, 'service.description');
// Azure: Group by resource group
const byResourceGroup = groupCosts(costs, 'ResourceGroup');
Tags/Labels:
// Cost allocation by tags
const byEnvironment = groupCosts(costs, 'tag:Environment');
// production: $X, staging: $Y, development: $Z
const byTeam = groupCosts(costs, 'tag:Team');
// backend: $X, frontend: $Y, data: $Z
const byProject = groupCosts(costs, 'tag:Project');
Region:
// Multi-region cost analysis
const byRegion = groupCosts(costs, 'REGION');
// us-east-1: $X, eu-west-1: $Y, ap-southeast-1: $Z
Based on cost analysis, generate recommendations:
Idle Resources:
Right-sizing Opportunities:
Storage Optimization:
Generate comprehensive reports:
Daily Report:
Weekly Report:
Monthly Report:
/cloud:cost-alert [options]
--provider <aws|gcp|azure|all> - Cloud provider to monitor (default: all)--threshold <amount> - Alert when cost exceeds amount (e.g., 1000)--budget <amount> - Set budget amount for tracking--alert-when <condition> - Alert condition: threshold-exceeded, budget-80, budget-100, forecast-exceeds--period <daily|weekly|monthly> - Cost aggregation period (default: daily)--anomaly-detection <threshold|trend|ml> - Detection method (default: threshold)--sensitivity <low|medium|high> - Detection sensitivity (default: medium)--baseline-days <number> - Days for baseline calculation (default: 30)--channel <slack|email|pagerduty|webhook> - Alert delivery channel--slack-webhook <url> - Slack webhook URL--email <addresses> - Comma-separated email addresses--pagerduty-key <key> - PagerDuty integration key--webhook-url <url> - Custom webhook endpoint--group-by <service|region|tag> - Group costs by dimension--tag-key <key> - Tag key for cost allocation (e.g., Environment, Team)--show-recommendations - Include optimization recommendations--report-type <daily|weekly|monthly> - Report type--output <path> - Save report to file--format <json|markdown|html> - Report format (default: markdown)/cloud:cost-alert --provider aws --threshold 1000 --channel slack
/cloud:cost-alert --provider gcp --budget 5000 --alert-when forecast-exceeds --channel email
/cloud:cost-alert --provider azure --anomaly-detection ml --sensitivity high --channel pagerduty
/cloud:cost-alert --provider all --group-by tag --tag-key Environment --show-recommendations
/cloud:cost-alert --report-type weekly --output ./reports/weekly-costs.md --format markdown
/cloud:cost-alert --provider aws --budget 10000 --alert-when budget-100 --channel pagerduty --channel email
This command orchestrates multiple cloud agents:
💰 Cloud Cost Alert Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Provider: AWS
Period: Daily (2025-10-21)
Current Cost: $1,234.56
Threshold: $1,000.00
Status: ⚠️ THRESHOLD EXCEEDED
Cost Breakdown:
EC2: $456.78 (37%)
RDS: $234.56 (19%)
S3: $123.45 (10%)
Lambda: $89.01 (7%)
CloudFront: $67.89 (5%)
Other: $262.87 (22%)
Anomaly Detection:
Method: ML-based
Result: ⚠️ Cost anomaly detected
Severity: High
Baseline (30-day avg): $875.23
Deviation: +41% from baseline
Budget Status:
Budget: $30,000 (Monthly)
Consumed: $18,456.78 (61.5%)
Days Remaining: 10
Forecast: $29,234.56 (97.4%)
Status: ⚠️ On track to exceed budget
Top Cost Increases:
1. EC2 (us-east-1): +$234.56 (+106%)
→ New c5.2xlarge instances launched
2. RDS (eu-west-1): +$89.45 (+62%)
→ Database storage increased
3. S3: +$45.23 (+58%)
→ Large data ingestion event
Optimization Recommendations:
💡 Right-size 4 over-provisioned EC2 instances → Save $156/day
💡 Enable auto-scaling for development workloads → Save $89/day
💡 Move infrequent S3 data to Glacier → Save $23/day
Alerts Sent:
✅ Slack: #cloud-costs
✅ Email: [email protected], [email protected]
⏩ PagerDuty: Incident created (#INC-12345)
Next Steps:
1. Review EC2 instance scaling in us-east-1
2. Investigate RDS storage growth
3. Apply recommended optimizations
4. Adjust budget if forecast is accurate
{
"provider": "AWS",
"date": "2025-10-21",
"period": "daily",
"cost": {
"total": 1234.56,
"currency": "USD",
"breakdown": {
"EC2": 456.78,
"RDS": 234.56,
"S3": 123.45
}
},
"alert": {
"triggered": true,
"type": "threshold_exceeded",
"severity": "high",
"threshold": 1000.00,
"deviation_percent": 23.5
},
"anomaly": {
"detected": true,
"method": "ml",
"baseline": 875.23,
"deviation_percent": 41,
"severity": "high"
},
"budget": {
"amount": 30000,
"consumed": 18456.78,
"percent": 61.5,
"forecast": 29234.56,
"status": "warning"
},
"recommendations": [
{
"type": "right-sizing",
"resource": "EC2 instances",
"savings_daily": 156,
"priority": "high"
}
]
}
Problem: Cost data not available or incomplete Solutions:
Problem: Too many alerts for normal cost variations Solutions:
Problem: Alerts not received via configured channels Solutions:
Problem: Cost forecasts significantly off from actual Solutions:
/cloud:cost-optimize - Analyze and optimize cloud costs/cloud:validate - Validate cloud infrastructure configuration/infra:deploy - Deploy infrastructure changesFiles this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub lagowski/claudeautopm --plugin cloud8 commands in this plugin
/cloud-cost-optimizecloud:cost-optimizeAnalyze and optimize cloud infrastructure costs across AWS, Azure, and GCP./cloud-validatecloud:validateValidate cloud infrastructure configuration and credentials across AWS, Azure, and GCP./disaster-recoverycloud:disaster-recoverySet up disaster recovery plans with RTO/RPO targets for multi-cloud infrastructure./infra-deployCloud Infrastructure DeploymentDeploys infrastructure to cloud providers using Terraform./k8s-deployKubernetes DeploymentDeploys applications to Kubernetes clusters./ssh-security-and-operationsSet up secure SSH configurations, key management, and remote operations.Other plugins' commands for the same job