Install any skill in seconds. Free to start, no credit card required.
Get Started Free →AWS SAM and CDK guidance for scaffolding, templating, deploying, and CI/CD of serverless applications on AWS.
Use this skill ↓78% 83%+4 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 18 of 23 without it.
3 of 3 safety checks passed
Not used yet
Both SAM and CDK synthesize CloudFormation. Choosing between them is a matter of team preference and project context.
| SAM | CDK | |
|---|---|---|
| Language | YAML/JSON (declarative) | TypeScript, Python, Java, Go, C# (imperative) |
| Learning curve | Lower — close to CloudFormation | Higher — requires familiarity with a programming language |
| Abstraction level | Handles wiring for Serverless resources | Rich L2/L3 constructs handle wiring automatically |
| Code sharing | Template fragments only | Full reuse via construct libraries (npm, PyPI) |
| Loops and conditions | Limited | Native language constructs (for, if, maps) |
| Testing | Manual template review | Unit tests with aws-cdk-lib/assertions |
| Best for | Lambda-centric apps, teams new to IaC | Large teams building reusable infrastructure patterns |
Choose SAM when your primary concern is Lambda functions and you want the SAM MCP tools.
Choose CDK when you have complex infrastructure, want to write reusable construct libraries, prefer a programming-language interface, or your team already uses CDK elsewhere.
Both tools support the get_iac_guidance MCP tool for additional context:
get_iac_guidance(iac_tool: "cdk")
npm install -g aws-cdk
cdk --version
# One-time account/region bootstrap (creates CDK toolkit stack)
cdk bootstrap aws://ACCOUNT-ID/REGION
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.