From aws-cost-saver
Validates AWS cost savings estimates against Pricing API and billing data for EC2, RDS, EBS, CloudWatch Logs. Updates findings.json to correct errors like storage vs ingestion before reports.
npx claudepluginhub prajapatimehul/claude-aws-cost-saver --plugin aws-cost-saverThis skill is limited to using the following tools:
**MANDATORY** validation step that catches pricing errors before they reach the user.
Conducts multi-round deep research on GitHub repos via API and web searches, generating markdown reports with executive summaries, timelines, metrics, and Mermaid diagrams.
Dynamically discovers and combines enabled skills into cohesive, unexpected delightful experiences like interactive HTML or themed artifacts. Activates on 'surprise me', inspiration, or boredom cues.
Generates images from structured JSON prompts via Python script execution. Supports reference images and aspect ratios for characters, scenes, products, visuals.
MANDATORY validation step that catches pricing errors before they reach the user.
Common errors this skill catches:
This skill validates pricing for ALL findings using the Zero Hallucination Pricing System. Every finding must have a verifiable pricing_source. Findings without a pricing source or with fabricated prices are rejected (set to monthly_savings=0 with pricing_unknown=true).
# Validate with default $100 threshold (queries API only for >$100 findings)
python skills/validating-aws-pricing/scripts/validate_pricing.py findings.json --profile ctm
# Lower threshold to validate more findings
python skills/validating-aws-pricing/scripts/validate_pricing.py findings.json --profile ctm --threshold 50
# Works with any AWS auth method (SSO, access keys, IAM role)
python skills/validating-aws-pricing/scripts/validate_pricing.py findings.json # uses default credentials
For findings above threshold (default $100):
monthly_savings with validated valueapi_validated: true in metadataFor findings below threshold:
api_validated: false in metadataAll findings get pricing_validated metadata showing the source.
Savings = Full monthly cost of the resource
savings = hourly_rate * 730 # Resource should be terminated
Savings = Storage cost per month
savings = size_gb * price_per_gb # e.g., 100GB * $0.08 = $8.00
Savings = Difference between current and recommended size
current_cost = current_hourly * 730
recommended_cost = recommended_hourly * 730
savings = current_cost - recommended_cost
Savings = On-Demand cost - Reserved Instance cost
on_demand_monthly = hourly_rate * 730
ri_monthly = ri_upfront / 12 + ri_hourly * 730
savings = on_demand_monthly - ri_monthly # ~40-60% typically
Savings = Storage cost that can be avoided with retention policy
savings = stored_gb * 0.03 # $0.03 per GB-month
Current pricing (us-east-1):
| Resource | Price | Unit | Monthly (730 hrs) |
|---|---|---|---|
| t2.nano | $0.0058 | /hour | $4.23 |
| t3.nano | $0.0052 | /hour | $3.80 |
| gp3 storage | $0.08 | /GB-month | - |
| db.r5.xlarge | $0.50 | /hour | $365.00 |
| cache.t3.small (Valkey) | $0.0272 | /hour | $19.86 |
| CloudWatch Logs | $0.03 | /GB-month | - |
For complete pricing, see PRICING_REFERENCE.md.
The script updates findings.json in place:
{
"check_id": "EC2-001",
"monthly_savings": 4.23,
"pricing_validated": {
"source": "AWS Pricing API",
"validated_at": "2026-01-19T10:00:00Z",
"hourly_rate": 0.0058,
"calculation": "0.0058 * 730 hours"
}
}
findings.jsoncheck_id and detailsmonthly_savings fieldpricing_validated metadatatotal_monthly_savings in metadatafindings.json- [ ] Load findings.json
- [ ] Get actual billing from Cost Explorer (by service AND usage type)
- [ ] ANTI-HALLUCINATION CHECKS (run first):
- [ ] Every finding has details.pricing_source (reject if missing)
- [ ] Every finding with savings > 0 has details.calculation (reject if missing)
- [ ] No findings have savings > 0 with pricing_source="pricing_unknown" (reject if found)
- [ ] No idle findings count missing metrics as zero activity (reject if found)
- [ ] Downsize targets are same-family-one-size-down or from Compute Optimizer (reject if not)
- [ ] For EACH finding:
- [ ] Verify formula matches finding type
- [ ] Check savings <= service spend (sanity check)
- [ ] Query AWS Pricing API for ALL findings with pricing_source != "aws_pricing_api"
- [ ] Check OS matches (Windows vs Linux) for EC2 findings
- [ ] Check deployment option matches (Multi-AZ vs Single-AZ) for RDS findings
- [ ] Check all EBS components (storage + IOPS + throughput) for EBS findings
- [ ] Recalculate if errors found
- [ ] Add calculation breakdown to details
- [ ] Flag any corrected findings with pricing_corrected: true
- [ ] Set any unfixable findings to monthly_savings=0 with pricing_unknown=true
- [ ] Recalculate total savings in metadata
- [ ] Save corrected findings.json
- [ ] Regenerate report with accurate prices
assert finding.monthly_savings <= service_monthly_spend, \
f"Finding {finding.check_id} claims ${finding.monthly_savings} but service only costs ${service_monthly_spend}"
Example Failure:
Many AWS services have MULTIPLE cost components:
| Service | Components | What Retention Affects |
|---|---|---|
| CloudWatch Logs | Ingestion ($0.50/GB) + Storage ($0.03/GB) | Storage ONLY |
| S3 | Storage + Requests + Transfer | Storage + old versions |
| EBS | Storage + IOPS + Throughput | Storage ONLY |
| RDS | Compute + Storage + I/O | Depends on finding |
For any finding > $100, get usage-type breakdown:
aws ce get-cost-and-usage --profile {profile} \
--time-period Start=2025-12-01,End=2026-01-01 \
--granularity MONTHLY \
--metrics UnblendedCost \
--filter '{"Dimensions": {"Key": "SERVICE", "Values": ["AmazonCloudWatch"]}}' \
--group-by Type=DIMENSION,Key=USAGE_TYPE
This shows:
DataProcessing-Bytes: Log ingestion ($0.50/GB)TimedStorage-ByteHrs: Log storage ($0.03/GB)Only storage can be reduced by retention policy!
WRONG:
savings = stored_gb * 0.50 # Using ingestion price!
# 221 GB * $0.50 = $110.50 # WRONG!
CORRECT:
savings = stored_gb * 0.03 # Storage price
# 221 GB * $0.03 = $6.63 # CORRECT!
Even more correct (check what % is older than retention):
# If setting 90-day retention, only logs older than 90 days are deleted
# Estimate 50% of stored data is older than 90 days
savings = stored_gb * 0.03 * 0.5
CORRECT:
savings = size_gb * price_per_gb
# gp3: 100 GB * $0.08 = $8.00
# gp2: 100 GB * $0.10 = $10.00
CORRECT:
current_cost = current_hourly * 730
recommended_cost = recommended_hourly * 730
savings = current_cost - recommended_cost
# db.r5.xlarge -> db.r5.large
# $0.50 * 730 - $0.25 * 730 = $365 - $182.50 = $182.50
After validation, each finding should include:
{
"check_id": "LOG-001",
"monthly_savings": 6.64,
"pricing_validated": {
"validated_at": "2026-01-19T12:00:00Z",
"original_estimate": 594.34,
"corrected": true,
"correction_reason": "Used storage price ($0.03/GB) instead of ingestion price ($0.50/GB)",
"calculation": "221.4 GB × $0.03/GB = $6.64",
"sanity_check": {
"service": "AmazonCloudWatch",
"service_spend": 159.13,
"finding_savings": 6.64,
"passed": true
}
}
}