The AWS Cloud Development Kit (CDK) is an open-source software development framework that lets you define cloud infrastructure using general-purpose programming languages β TypeScript, JavaScript, Python, Java, C#, and Go β which the CDK then synthesizes into AWS CloudFormation templates for deployment. It sits squarely in the infrastructure-as-code (IaC) space and is AWS's primary answer to the developer-productivity limitations of writing raw YAML or JSON. The key insight that separates CDK from declarative IaC tools is that your infrastructure is real code: you get loops, conditionals, type-checking, unit tests, and package managers to compose and share reusable building blocks called constructs. Because CDK compiles to CloudFormation under the hood, it inherits CloudFormation's change-set model, resource limits (500 per stack), and eventual consistency behavior β understanding that contract is what separates smooth CDK users from frustrated ones.
What This Cheat Sheet Covers
This topic spans 18 focused tables and 114 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Construct Levels (L1 / L2 / L3)
Constructs are the core abstraction in CDK β composable classes that represent one or more AWS resources. They are organized into three abstraction levels, and choosing the right level for each situation is the single most important CDK design decision.
| Type | Example | Description |
|---|---|---|
new s3.CfnBucket(this, 'Bucket', { bucketName: 'my-bucket' }) | β’ Direct 1-to-1 mapping to a CloudFormation resource β’ named Cfn<ResourceType>β’ no defaults, full control over every property | |
new s3.Bucket(this, 'Bucket', { encryption: BucketEncryption.KMS }) | Intent-based API that wraps one CloudFormation resource with sensible defaults, best-practice security policies, and helper methods (grants, metrics, event notifications). Most commonly used level. | |
new ecsPatterns.ApplicationLoadBalancedFargateService(this, 'Svc', { ... }) | β’ Opinionated combination of multiple resources that deliver a complete architecture β’ fewest lines of code for the most infrastructure |