All skills
aws avatar

/aws-billing-and-cost-management

@b33847d

Analyze AWS costs, find savings, manage budgets, evaluate Savings Plans and Reserved Instances, right-size EC2/Lambda/RDS/EBS with Compute Optimizer, look up service pricing, query CUR with Athena, detect cost anomalies, scope costs to billing views, and monitor Free Tier usage. Triggers on: AWS bill, cost analysis, reduce spend, savings plan, reserved instance, right-size, budget alert, cost optimization, pricing, free tier, cost anomaly, CUR, cost audit, billing view, billing view ARN.

Use this Skill: https://skilld.dev/gh/aws/agent-toolkit-for-aws/aws-billing-and-cost-management

This session only. Nothing lands on disk.

referencesdeterministic-calculations.md

≈649 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Deterministic Calculations

You MUST NEVER perform arithmetic by reasoning in your response. This includes sums, averages, percentages, percent changes, counts, min/max, or any math on data from API calls. LLM arithmetic is unreliable and produces wrong cost figures.

You MUST ALWAYS write a script to perform calculations and print the result.

Pattern: Python script for Cost Explorer data

After calling aws ce get-cost-and-usage, extract the numbers and calculate with a script:

# Example: Calculate total cost and percent change from CE response data
import json

# Data extracted from API responses (replace with actual values)
current_month = [("EC2", 1500.42), ("S3", 823.17), ("RDS", 612.90)]
previous_month = [("EC2", 1200.00), ("S3", 750.00), ("RDS", 580.00)]

current_total = sum(cost for _, cost in current_month)
previous_total = sum(cost for _, cost in previous_month)
pct_change = ((current_total - previous_total) / previous_total) * 100

print(f"Current total: ${current_total:,.2f}")
print(f"Previous total: ${previous_total:,.2f}")
print(f"Change: {pct_change:+.1f}%")

for service, cost in current_month:
    pct_of_total = (cost / current_total) * 100
    print(f"  {service}: ${cost:,.2f} ({pct_of_total:.1f}%)")

Pattern: Count and aggregate

# Example: Count exceeded budgets from Budgets API response
budgets = [("Monthly-Total", "EXCEEDED"), ("Dev-Budget", "OK"), ("Prod-Budget", "EXCEEDED")]
exceeded = [name for name, status in budgets if status == "EXCEEDED"]
print(f"Exceeded budgets: {len(exceeded)} — {', '.join(exceeded)}")

Pattern: Savings calculation

# Example: Calculate savings from right-sizing recommendations
recs = [
    {"instance": "i-abc123", "current_cost": 121.03, "recommended_cost": 16.64},
    {"instance": "i-def456", "current_cost": 350.00, "recommended_cost": 175.00},
]
total_current = sum(r["current_cost"] for r in recs)
total_recommended = sum(r["recommended_cost"] for r in recs)
total_savings = total_current - total_recommended
pct_savings = (total_savings / total_current) * 100
print(f"Total monthly savings: ${total_savings:,.2f} ({pct_savings:.1f}%)")
print(f"Annual savings: ${total_savings * 12:,.2f}")

Why this matters

  • LLMs frequently make arithmetic errors on multi-digit numbers, especially with percentages and aggregations
  • Cost data involves currency — wrong numbers erode customer trust immediately
  • Scripts produce verifiable, reproducible results
  • The AWS MCP server's run_script tool runs Python in a sandbox — use it when available

Source: SKILL.md on GitHub

No alerts17d3 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill provides comprehensive instructions for analyzing and optimizing AWS costs. It incorporates security-conscious patterns, such as recommending sandboxed execution via the AWS MCP server and requiring deterministic Python scripts for all mathematical calculations to ensure data integrity and accuracy.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

Signed by skilld at b33847d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
metadata
{
  "version": "1"
}

README badge

README badge for aws/agent-toolkit-for-aws/aws-billing-and-cost-management