Case Study
Slate - Pre-Deployment AWS Cost Estimation for CDK
Zero-config CLI that reads CDK synth output, calls AWS Price List API for real prices, and produces tiered cost estimates before deployment.
Hats I Wore
Project Overview
AI-assisted IaC development generates working infrastructure fast — but a single configuration decision (NAT Gateway, multi-AZ RDS, DynamoDB billing mode change) can shift monthly costs by hundreds of dollars silently. Slate makes that visible before you deploy.
How It Works
cdk synth → CDK Adapter → Classifier → AWS Price List API → Free Tier Deduction → Calculator → Output
- CDK Adapter — reads
cdk.out/manifest.json+ CloudFormation templates, normalizes resources - Classifier — categorizes each resource as Fixed (exact price) or Variable (scales with users)
- Pricing Client — calls AWS Price List API for region-accurate unit prices (never hardcoded)
- Free Tier — deducts AWS Free Tier allowances for accurate low-tier estimates
- Calculator — multiplies variable costs across user growth tiers
- Output — renders tier table, generates
cost-profile.yaml, writes report JSON
Key Features
- Zero config — works immediately after
cdk synthwith no setup - Real prices — all costs from AWS Price List API, never hardcoded
- Tiered output — costs across 0–100, 100–1k, 1k–10k, 10k–100k, 100k–1M users
- Free tier modeling — accurate $0 estimates at low usage
- Cost drift detection — diffs between runs show what changed
- CI/CD budget gate — exits code 1 if cost exceeds threshold
- MCP server — expose cost tools to AI editors (Kiro, VS Code, Continue)
- Interactive wizard — guided CLI to fill in usage assumptions
The Precision Dial
cost-profile.yaml is generated with fields for detected variable resources. Fill in what you know — leave blank what you don't.
| Fields filled | Output | |---|---| | None | All variable costs shown as min–max range | | Some | Filled fields exact, empty fields ranged | | All | Every line item exact |
Technologies
TypeScript, ESM, Commander, @aws-sdk/client-pricing, @inquirer/prompts, js-yaml, chalk, tsup, vitest
Interested in similar solutions?
Let's discuss how I can help architect and build scalable systems for your organization.