From ai-toolkit
Reviews Terraform configs for cost estimation, providing sizing recommendations, common AWS patterns, and optimization tips for RDS, ElastiCache, NAT, ECS Fargate, and EKS.
npx claudepluginhub c0x12c/ai-toolkit --plugin ai-toolkit[optional: resource-type]spartan/@rules/infrastructure/STRUCTURE.md
@rules/infrastructure/MODULES.md
# Terraform Cost Estimation: {{ args[0] | default: "infrastructure review" }}
Review infrastructure costs and provide sizing recommendations.
## Step 1: Identify Resources
## Step 2: Common Cost Patterns
### RDS (PostgreSQL/Aurora)
| Environment | Instance | Storage | Multi-AZ | Est. Monthly |
|-------------|----------|---------|----------|-------------|
| dev | `db.t3.micro` | 20 GB gp3 | No | ~$15 |
| staging | `db.t3.small` | 50 GB gp3 | No | ~$30 |
| prod | `db.r6g.large` | 100 GB gp3 | Yes | ~$400 |
**Optimiza...@rules/infrastructure/STRUCTURE.md @rules/infrastructure/MODULES.md
Review infrastructure costs and provide sizing recommendations.
# List all resource types in the current config
grep -r "^resource " *.tf modules/ 2>/dev/null | awk '{print $2}' | sort | uniq -c | sort -rn
| Environment | Instance | Storage | Multi-AZ | Est. Monthly |
|---|---|---|---|---|
| dev | db.t3.micro | 20 GB gp3 | No | ~$15 |
| staging | db.t3.small | 50 GB gp3 | No | ~$30 |
| prod | db.r6g.large | 100 GB gp3 | Yes | ~$400 |
Optimization:
db.t3.* for dev/staging — burstable is fine for low traffic| Environment | Instance | Replicas | Est. Monthly |
|---|---|---|---|
| dev | cache.t3.micro | 0 | ~$12 |
| staging | cache.t3.small | 0 | ~$25 |
| prod | cache.r6g.large | 1 | ~$300 |
Cost trap: NAT gateways charge per hour AND per GB processed.
| Setup | Est. Monthly |
|---|---|
| 1 NAT per AZ (3 AZs) | ~$100 + data |
| 1 shared NAT | ~$33 + data |
| NAT instance (t3.micro) | ~$8 |
Optimization:
| Size | vCPU | Memory | Est. Monthly (24/7) |
|---|---|---|---|
| Micro | 0.25 | 0.5 GB | ~$9 |
| Small | 0.5 | 1 GB | ~$18 |
| Medium | 1 | 2 GB | ~$36 |
| Large | 2 | 4 GB | ~$73 |
Optimization:
| Environment | Instance | Nodes | Est. Monthly |
|---|---|---|---|
| dev | t3.medium | 2 | ~$60 + $75 (control plane) |
| prod | m6i.xlarge | 3-6 | ~$300-600 + $75 |
Note: EKS control plane is $75/month regardless of size.
| Resource | Dev | Prod | Savings |
|---|---|---|---|
| RDS | t3.micro, no Multi-AZ | r6g.large, Multi-AZ | 95% |
| Redis | t3.micro, no replica | r6g.large, 1 replica | 95% |
| NAT | 1 shared or NAT instance | 1 per AZ | 70% |
| Fargate | Spot, min replicas | On-demand, auto-scale | 60% |
| EKS | Spot nodes, smaller | On-demand, right-sized | 50% |
Review the Terraform config and produce:
## Cost Estimate: {env}
| Resource | Type | Size | Est. Monthly |
|----------|------|------|-------------|
| RDS | PostgreSQL | db.t3.small | $30 |
| ... | ... | ... | ... |
**Total estimated:** $X/month
**Potential savings:** $Y/month with [recommendations]