PROVIDER - Define AWS resources in code

AWS CDK

AWS CDK lets developers define AWS resources in 6 languages, synthesising CloudFormation templates that reuse native deployment while official constructs cover 200+ services; the boundaries are tight AWS coupling and a steeper learning curve than YAML templates.

Developer Tools United States 2026.11.19
4.4pts

Service Overview

AWS CDK (Cloud Development Kit) is Amazon's official infrastructure as code framework. Developers describe resources in a high-level language, and the CDK synthesises a standard CloudFormation template that AWS then executes.

In the development tools category it represents the "infrastructure in a programming language" route: unlike Terraform's declarative HCL, the CDK leans on a language's type system, loops and package management to model complex topologies.

Key Strengths

  • Multi-language: 6 options including TypeScript, Python, Java, C# and Go
  • Native deployment: synthesises CloudFormation and inherits AWS rollout and rollback
  • Three abstraction tiers: L1 resources, L2 conveniences and L3 patterns as needed
  • Construct ecosystem: 200+ services officially, extended by Construct Hub
  • Type safety: attribute validation and completion directly in the editor

Product Ecosystem

Platform capabilities

Resource modelling, template synthesis, change diffing, environment bootstrapping, multi-stack organisation and cross-account deployment.

Integrations

Works with AWS CodePipeline, GitHub Actions, CDK for Terraform, Projen and standard test frameworks.

Typical scenarios

Applications and data pipelines on AWS, platform teams packaging reference architectures, and unified delivery across environments and accounts.

Limitations

  • Platform coupling: optimised for AWS, so cross-cloud work needs abstraction
  • High-level ceilings: L3 constructs trade flexibility for convenience
  • Learning barrier: programming skills are a prerequisite for the team
  • Debug depth: issues often require reading the generated template layer

Use Cases

  • AWS-native projects (★★★★★): the language and platform pairing is smoothest here
  • Complex topology modelling (★★★★★): loops and functions express repetition cleanly
  • Platform team packaging (★★★★☆): publish standard architectures as construct libraries
  • Cross-cloud infrastructure (★★☆☆☆): Terraform-style tools fit better

Pricing

Item Price Notes
AWS CDK $0 Apache 2.0 open source, free to use
CloudFormation $0 No extra charge; resources bill by usage
Bootstrap resources Usage based Normal costs for S3, IAM and ECR

FAQ

How does CDK relate to CloudFormation templates?

CDK is the authoring layer; the output is a standard CloudFormation template that performs the deployment.

How do I choose between CDK and Terraform?

Choose CDK for deep AWS use with a programming-fluent team; choose Terraform for unified multi-cloud management.

Are custom resources supported?

Yes. L1 constructs, custom resources and property overrides extend coverage beyond the official library.

Can changes be previewed locally?

Yes. cdk diff prints the resource changes that would occur, which supports pre-deployment review.

Code Examples

import * as cdk from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';

export class DemoStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // L2 construct applies secure defaults automatically
    new s3.Bucket(this, 'Assets', {
      versioned: true,
      encryption: s3.BucketEncryption.S3_MANAGED,
      removalPolicy: cdk.RemovalPolicy.RETAIN,
    });
  }
}
# Bootstrap the account and deploy
cdk bootstrap aws://123456789012/us-east-1
cdk diff
cdk deploy

Community & Resources

Visit AWS CDK Website → https://aws.amazon.com/cdk/
Visit Website ↗