Skip to content

opensite-ai/opensite-skills / aws-billing-and-cost-management

aws-billing-and-cost-management

Verified

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.

references/service-optimization.md

View on GitHub
# Per-Service Cost Optimization

> **Pricing note:** All prices shown are us-east-1 approximate as of early 2026. Prices vary by region and may change. Always verify current pricing via the Price List API before reporting to users.

Quick wins that don't require commitment purchases. Prioritize by estimated savings.

## S3: Storage Class Optimization

| Strategy | Savings | When |
|----------|---------|------|
| Intelligent-Tiering | Auto-optimized | Unknown access patterns, objects ≥128KB |
| Lifecycle to S3-IA | ~45% storage | Known infrequent access after 30+ days |
| Lifecycle to Glacier IR | ~68% storage | Archive after 90+ days, retrieval in minutes |
| Lifecycle to Deep Archive | ~95% storage | Compliance retention, 12+ hour retrieval OK |

**Gotchas:** Objects <128KB NOT auto-tiered in IT. Minimum storage durations: S3-IA 30 days, Glacier IR 90 days, Deep Archive 180 days — early deletion incurs prorated charge. Always add `NoncurrentVersionExpiration` — old versions accumulate silently.

## Lambda: Memory and Architecture

| Strategy | Savings | Effort |
|----------|---------|--------|
| Switch to arm64 (Graviton) | ~20% cost | Low — config change |
| Right-size memory | 10-50% | Medium — use Power Tuning |
| SnapStart (Java/Python/.NET) | Eliminates provisioned concurrency cost | Low |

**Gotchas:** Reserved concurrency (free) ≠ Provisioned concurrency (paid). 1,769 MB = 1 full vCPU — more memory = more CPU = potentially lower total cost.

## NAT Gateway: VPC Endpoints

NAT Gateway: ~$0.045/hr (~$32/month) + ~$0.045/GB. Often the #1 surprise cost.

**Always create free gateway endpoints for S3 and DynamoDB:**
```bash
aws ec2 create-vpc-endpoint --vpc-id vpc-123abc \
  --service-name com.amazonaws.<REGION>.s3 --route-table-ids rtb-123abc
```

Interface endpoints cost ~$0.01/hr/AZ + ~$0.01/GB — cheaper than NAT only for high-traffic services. Do the math before adding many interface endpoints.

## CloudWatch: Log Retention

Default retention is "Never expire" — logs accumulate at ~$0.03/GB/month.

```bash
# Find log groups without retention
aws logs describe-log-groups \
  --query "logGroups[?!retentionInDays].{Name:logGroupName,StoredBytes:storedBytes}" --output table
```

**Gotchas:** Log class cannot be changed after creation. Infrequent Access class does NOT support metric filters, subscription filters, or live tail. Custom metrics: each unique dimension combination is a separate metric (~$0.30/metric/month in us-east-1).

## DynamoDB: Capacity Mode

On-demand is ~6x more expensive per request than provisioned at steady state. Start on-demand for new tables, switch to provisioned once traffic patterns are known. Can switch modes once per 24 hours. Database Savings Plans (up to 35%) now apply to DynamoDB on-demand.

## ECS/EKS: Fargate Spot

Fargate Spot: up to 70% discount, 2-minute interruption warning. Always have Fargate fallback with `base=1`. EKS control plane costs $0.10/hr ($73/month) regardless of node count — not covered by any SP.
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall