aws-cost-optimization

star 3

AWS cost optimization with billing analysis, RI/SP evaluation, storage optimization, idle resource identification, and interactive cost reports

aws-samples By aws-samples schedule Updated 2/25/2026

name: aws-cost-optimization description: AWS cost optimization with billing analysis, RI/SP evaluation, storage optimization, idle resource identification, and interactive cost reports tools: - aws_pricing - billing_analysis

AWS Cost Optimization

Analysis Process

  1. Data Collection: Use query_price tool to get current pricing for relevant services
  2. Billing Analysis: If the customer provides a billing file (CSV or Excel), use analyze_billing tool to:
    • Parse the file and compute per-service cost distribution
    • Detect month-over-month anomalies (services with >20% cost growth)
    • Generate an interactive HTML report with Chart.js charts (pie chart for distribution, bar chart for monthly trends)
    • The tool returns total_cost, top_services, anomalies, and a report_url for the visual report
  3. Resource Assessment: Retrieve resource usage data via MCP-connected AWS CLI tools
  4. Optimization Recommendations:
    • Reserved Instance / Savings Plan evaluation (refer to references/ri-sp-guide.md)
    • Storage tier optimization (S3 Intelligent-Tiering, EBS gp3 migration)
    • Idle resource cleanup (unused EIPs, idle EBS volumes, stopped EC2 instances)
    • Data transfer optimization (CloudFront, VPC Endpoints)
  5. Report Generation: Generate cost optimization report using templates/cost-report.md template. When billing data is available, fill in the Billing Analysis section with anomalies, cost distribution, and link to the interactive HTML report

Key Checks

  • EC2: Instance utilization < 30% — recommend downsizing or Spot
  • RDS: Is Multi-AZ necessary? Is storage type optimal?
  • S3: Lifecycle policies, storage class distribution
  • Lambda: Memory over-provisioned? Execution time optimization
  • NAT Gateway: Can data transfer costs be reduced via VPC Endpoints?

Billing Analysis Workflow

When the customer provides an AWS billing file:

  1. Ask the customer to upload the billing CSV or Excel file
  2. Call analyze_billing with the uploaded file URL and format (csv or excel)
    • Optional: set anomaly_threshold to customize sensitivity (default 20%)
  3. Review the returned anomalies list — services with cost growth above the threshold need immediate attention
  4. Use top_services from the result to focus optimization efforts on the highest-cost services
  5. Cross-reference the cost distribution with query_price to identify pricing optimization opportunities (e.g., RI/SP for top-cost EC2 instances)
  6. Share the report_url (interactive HTML report) with the customer as a visual aid
  7. Incorporate findings into the final cost optimization report using the template

Billing File Requirements

The analyze_billing tool accepts:

  • Formats: CSV or Excel (xlsx/xls)
  • Expected columns: Service name, Date/Month, Cost/Amount (flexible column name matching)
  • If the file format is invalid, the tool returns an error with format guidance — relay this to the customer

Referenced Tools

  • query_price: Query AWS real-time pricing for specific services and regions
  • analyze_billing: Parse AWS billing files (CSV/Excel), detect cost anomalies (configurable threshold), generate interactive HTML reports with Chart.js visualizations
  • execute_code: Data analysis and custom calculations
  • create_file: Generate report files and deliverables
Install via CLI
npx skills add https://github.com/aws-samples/sample-for-bedrock-agentcore-strands-agents --skill aws-cost-optimization
Repository Details
star Stars 3
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator