Cloud Parts

AWS Cloud Development Kit (CDK)

Define AWS infrastructure in TypeScript, Python, Java, C# or Go; the CDK turns it into CloudFormation templates and CloudFormation deploys them.

Type
Managed service on AWS
Made by
Amazon Web Services
License
Apache 2.0
Facts checked
6 October 2026

What it is

A CDK app is an ordinary program. You create stacks and fill them with constructs, using the language’s loops, conditionals, functions and classes and your editor’s autocomplete. Running cdk synth executes the program and produces a cloud assembly: a CloudFormation template for each stack plus the Lambda code and Docker images it references. cdk diff shows what would change and cdk deploy hands the template to AWS CloudFormation, which creates or updates the resources in order and rolls back on error. CloudFormation keeps track of what exists, so there is no state file for you to store. Each account and region first needs cdk bootstrap, which creates a CDKToolkit stack with an S3 bucket and ECR repository for assets and the IAM roles deployments use.

Constructs come in three levels. L1 constructs, named Cfn…, map one-to-one to CloudFormation resources with every property exposed. L2 constructs, the ones most people use, wrap a single resource with secure defaults and helpers such as bucket.grants.read(role), which writes the IAM policy for you. L3 constructs, or patterns, assemble whole architectures: ApplicationLoadBalancedFargateService produces a CloudFormation template of more than 500 lines and over 50 resources from a short block of code. The library is written in TypeScript and made available in the other languages through jsii. Since v2 (December 2021) it ships as a single package, aws-cdk-lib; the CLI is now released separately, and in September 2026 the library was at 2.272 and the CLI at 2.1144.

Why teams pick it

  • Real programming languages: abstraction, reuse, unit tests and IDE support instead of templating YAML
  • L2 and L3 constructs encode AWS defaults and least-privilege grants, so a few lines create a working, permissioned setup
  • No state file to manage: CloudFormation tracks the resources and rolls failed deployments back
  • Constructs are shareable packages, so a platform team can publish its own approved building blocks

Watch out for

  • AWS only: everything goes through CloudFormation, so other clouds and SaaS need separate tools or custom resources
  • Inherits CloudFormation’s limits, such as 500 resources per template, slow deployments and rollbacks that can fail and get stuck
  • What you write isn’t what runs: your code generates a template that CloudFormation then deploys, and high-level patterns can hide costly resources such as NAT gateways
  • Its Terraform sibling is gone: HashiCorp archived CDK for Terraform (CDKTF) in December 2025 and points its users to plain HCL or to the AWS CDK

Alternatives

What all infrastructure as code have in common →

How it fits with other technologies

An L2 bucket, a group, and a grant that writes the IAM policy · ts

import { App, Stack } from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as iam from 'aws-cdk-lib/aws-iam';

const app = new App();
const stack = new Stack(app, 'DataStack');

const rawData = new s3.Bucket(stack, 'raw-data', {
  encryption: s3.BucketEncryption.KMS,
});
const dataScience = new iam.Group(stack, 'data-science');
rawData.grants.read(dataScience);        // least-privilege read policy

// $ cdk synth    -> CloudFormation template
// $ cdk diff     -> what would change
// $ cdk deploy   -> CloudFormation creates the stack

See it in a real stack

No architecture uses AWS Cloud Development Kit (CDK) yet. Drop it into the playground and wire it up yourself.Open playground →
Where it came from2011–2025

AWS CloudFormation launched in 2011 with JSON templates that list every resource and its properties. Text templates miss most of what programming languages offer; AWS’s own launch post for the CDK noted how easily a YAML file is truncated in transfer or loses a line in copy and paste. From 2013 people wrote libraries to generate templates from general-purpose languages instead.

AWS built its own. The CDK’s repository was created in October 2017, it was released as a developer preview in 2018, and on July 11, 2019 AWS announced general availability for TypeScript and Python, with Java and C# still in preview. The core idea was the construct: a cloud component that can contain other constructs, from a single bucket to a multi-account application, composed into stacks. To offer one library in many languages, AWS wrote it once in TypeScript and generated bindings with jsii.

CDK v2, generally available on December 2, 2021, folded the per-service packages into one, aws-cdk-lib, containing only stable APIs; v1 reached end of support on June 1, 2023. The construct model spread beyond AWS, notably to HashiCorp’s CDK for Terraform, but HashiCorp archived that project on December 10, 2025, saying it had not found product-market fit at scale, while the AWS CDK continues with frequent releases.

Why it’s built this way

Generate CloudFormation instead of calling APIs directly
CloudFormation already handled ordering, state and rollback for every AWS service. Building on it let the CDK focus on the programming model, at the cost of inheriting CloudFormation’s speed and limits.
Constructs that nest, in three levels
Raw resources (L1), curated resources with defaults (L2) and whole patterns (L3) let teams choose between full control and few lines, and package their own conventions as reusable components.
Write once in TypeScript, generate other languages with jsii
Maintaining separate libraries per language would never keep up with AWS. jsii lets code in other languages call the TypeScript classes, so every language gets the same constructs.
One package with only stable APIs in v2
In v1 every AWS service was a separate package to download. A single semver-stable aws-cdk-lib made upgrades simple, with experimental modules shipped separately.

Timeline

  1. 2011

    AWS CloudFormation launches with JSON templates

  2. 2017

    The aws-cdk repository is created in October

  3. 2018

    AWS CDK released as a developer preview

  4. 2019

    General availability for TypeScript and Python on July 11

  5. 2021

    CDK v2 with the single aws-cdk-lib package on December 2

  6. 2023

    CDK v1 reaches end of support on June 1

  7. 2025

    HashiCorp archives CDK for Terraform on December 10

Sources13 · facts checked 6 October 2026

Improve this page on GitHub