This article is based on the AWS CDK general availability announcement originally reported by InfoQ (July 2019).
What Is the AWS Cloud Development Kit (CDK)?
Amazon Web Services announced the general availability (GA) of the AWS Cloud Development Kit (CDK), an extensible open-source framework that lets developers model and provision AWS cloud infrastructure using familiar general-purpose programming languages. Rather than writing verbose YAML or JSON CloudFormation templates, engineers can express infrastructure as code using the same language, IDE, and toolchain they already use for application development.
AWS released a developer preview of CDK the previous year to gather feedback and iterate on the framework. The preview included support for TypeScript, JavaScript, and Java, later adding .NET and Python. At GA, the officially supported languages were TypeScript and Python.
Why CDK Over YAML or JSON Templates?
YAML and JSON are data-serialization formats. They are static, lack abstraction mechanisms, and offer no native support for loops, conditionals, or reusable components beyond basic anchors. The AWS CDK addresses these limitations by letting developers use real programming constructs:
- IDE autocompletion and parameter hints — modern editors surface available properties and valid values as you type.
- Type safety — especially in TypeScript, incorrect resource configurations can be caught at compile time rather than during a CloudFormation deployment.
- Reusable abstractions — common patterns (VPC with subnets, ECS service with ALB, etc.) can be encapsulated in classes and shared across teams or published to package registries.
- Unified repository — application code and infrastructure code can live in the same repo, reviewed in the same pull request, and tested with the same CI pipeline.
As Danilo Poccia, AWS Developer Advocate, wrote in the GA announcement blog post:
“Personally I really like that by using the AWS CDK, you can build your application, including the infrastructure, in your IDE, using the same programming language and with the support of autocompletion and parameter suggestion that modern IDEs have built-in, without having to do a mental switch between one tool, or technology, and another.”
Danilo Poccia, AWS Developer Advocate
Core Concepts: Constructs, Stacks, and Apps
The CDK programming model is built around three layered concepts:
Constructs
A construct is the basic building block of a CDK application — a cloud component that can represent anything from a single AWS resource (such as an S3 bucket or a Lambda function) to a complex, reusable architecture pattern spanning multiple services. Constructs can be composed: you build higher-level constructs out of lower-level ones, creating your own library of proven infrastructure patterns.
Stacks
A stack is a deployable unit composed of one or more constructs. Each CDK stack maps directly to an AWS CloudFormation stack. CDK synthesizes your code into a CloudFormation template and uses CloudFormation to provision the actual resources, meaning CDK sits on top of — rather than replacing — CloudFormation.
Apps
An app is the top-level container: a collection of one or more stacks. A single CDK app can span multiple AWS accounts and regions, making it practical to model entire environments (dev, staging, production) within one codebase.
The CDK CLI: Key Commands
Developers manage CDK applications through the AWS CDK Command Line Interface (CLI), which requires Node.js to be installed regardless of which application language you choose. Key commands include:
| Command | Purpose |
|---|---|
cdk init | Scaffold a new CDK project in the current directory using a supported language template. |
cdk synth | Synthesize the CDK app into a CloudFormation template for review before deployment. |
cdk diff | Show the difference between the deployed stack and the current local state. |
cdk deploy | Deploy one or more stacks to your AWS account and region. |
cdk destroy | Delete the deployed stack and its resources from your AWS account. |
cdk | Run without subcommands to list all available commands and options. |
The CDK CLI integrates naturally into CI/CD pipelines. Teams can invoke cdk deploy from tools such as Jenkins, AWS CodeBuild, or any other pipeline that can execute shell commands, enabling fully automated infrastructure deployments alongside application releases.
A Minimal CDK Example (TypeScript)
The following snippet illustrates how concise CDK infrastructure definitions can be compared to equivalent raw CloudFormation YAML:
import * as cdk from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';
export class MyStorageStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Create a versioned S3 bucket — CDK sets sane defaults automatically
new s3.Bucket(this, 'MyBucket', {
versioned: true,
removalPolicy: cdk.RemovalPolicy.DESTROY,
});
}
}
const app = new cdk.App();
new MyStorageStack(app, 'MyStorageStack');Code language: JavaScript (javascript)
Running cdk synth on this code produces the equivalent CloudFormation YAML, which CDK then passes to CloudFormation for deployment.
Availability, Licensing, and Resources
- Cost: The CDK itself is free to use. You pay only for the AWS resources your stacks provision.
- License: CDK is open source, released under the Apache 2.0 license.
- Source code: Available on GitHub at github.com/aws/aws-cdk.
- Documentation: The official AWS CDK Developer Guide is available in the AWS documentation portal.
- Construct Hub: A public registry of reusable CDK constructs contributed by AWS and the community (launched after the GA; not part of the original 2019 announcement).
Impact on Infrastructure-as-Code Workflows
The GA of AWS CDK marked a meaningful shift in how teams approach infrastructure-as-code on AWS. By collapsing the boundary between application and infrastructure development, CDK enables several workflow improvements:
- Predictable changes: Code review, version control, and PR-based workflows apply equally to infrastructure changes.
- Simpler testing: Infrastructure logic can be unit-tested using standard testing frameworks (Jest for TypeScript, pytest for Python) before any resources are provisioned.
- Faster onboarding: Engineers already familiar with Python or TypeScript do not need to master a separate DSL or template language.
- Reusability: Teams can publish internal construct libraries to internal package registries (npm, PyPI) for consistent, governed infrastructure patterns across projects.
For DevOps teams working heavily on AWS, the CDK represents a pragmatic evolution beyond raw CloudFormation templates, offering the expressiveness of a real programming language while retaining CloudFormation’s reliable state management and rollback capabilities underneath.