Skip to main content
Pulumi vs AWS CDK: Real-Code IaC Compared

Pulumi vs AWS CDK: Real-Code IaC Compared

KU
· Founder & Chief Editor
• 8 min read•Updated •

Both Pulumi and AWS CDK let you define infrastructure in real programming languages, but they split hard on multi-cloud, state, and engine maturity.

Key takeaways

  • Pick AWS CDK if you are AWS-only and want CloudFormation to own state and rollback.
  • Pick Pulumi if you run more than one cloud or many SaaS providers and accept owning a state backend.
  • CDK for Terraform is no longer an option: HashiCorp archived it on December 10, 2025.

Choose AWS CDK if you are staying on AWS and want CloudFormation to hold your state and roll back failed deploys. Choose Pulumi if you run several clouds or SaaS providers and want one engine for all of them, at the cost of owning a state backend. The engine underneath is the real decision.

Verified against

AWS CDK v2.275.0, Pulumi CLI v3.273.0, Pulumi AWS provider v7.52.1, against the AWS CDK v2 Developer Guide, the Pulumi state and backends docs, the Pulumi AWS registry and the archived terraform-cdk repository. Checked October 2026.

If you've ever hit the wall of HCL loops or YAML anchors and thought "I just want a for-loop and a type checker," both tools are the answer: TypeScript, Python, Go, or C#, with real functions, real classes, and an IDE that autocompletes resource properties. That shared premise hides a deep architectural split, and picking the wrong side means committing to the wrong cloud strategy or the wrong deployment engine for years.

The core split

AWS CDK is a code layer that generates CloudFormation. Your TypeScript or Python program runs during a synth step and emits a CloudFormation template, which AWS then deploys. CDK is AWS-only by design. Everything it produces is a CloudFormation stack.

Pulumi is a full engine. Your program talks to Pulumi's own deployment engine, which calls cloud provider APIs directly, through native providers or providers bridged from Terraform. There is no CloudFormation, no intermediate template you have to reason about. Pulumi covers AWS, Azure, GCP, Kubernetes, Cloudflare, Datadog, and many other providers with the same programming model.

That single difference cascades into everything else: state, speed, rollback behavior, and how far your knowledge transfers when you add a second cloud.

What the code looks like

Here's an S3 bucket with versioning in CDK:

lib/storage-stack.ts
import { Stack, StackProps, RemovalPolicy } from 'aws-cdk-lib';
import { Bucket, BucketEncryption } from 'aws-cdk-lib/aws-s3';
import { Construct } from 'constructs';

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

    new Bucket(this, 'AssetBucket', {
      versioned: true,
      encryption: BucketEncryption.S3_MANAGED,
      removalPolicy: RemovalPolicy.RETAIN,
    });
  }
}

The equivalent in Pulumi, in Python, using the AWS provider v7 resource names (BucketV2 is deprecated in favor of aws.s3.Bucket):

__main__.py
import pulumi
import pulumi_aws as aws

bucket = aws.s3.Bucket("asset-bucket")

aws.s3.BucketVersioning(
    "asset-bucket-versioning",
    bucket=bucket.id,
    versioning_configuration={"status": "Enabled"},
)

aws.s3.BucketServerSideEncryptionConfiguration(
    "asset-bucket-encryption",
    bucket=bucket.id,
    rules=[{"apply_server_side_encryption_by_default": {"sse_algorithm": "AES256"}}],
)

pulumi.export("bucket_name", bucket.id)

Notice the shape difference. CDK's constructs bundle related settings into one high-level object with sensible defaults. Pulumi mirrors the provider's resource model more closely, so you compose the primitives yourself. CDK feels more opinionated, Pulumi feels closer to the metal.

State management

This is where the two philosophies diverge most.

CDK has no state of its own. CloudFormation is the state store. AWS tracks what exists, computes changesets, and holds the record of every resource in the stack. You never manage a state file, you never worry about locking, and drift detection is a native CloudFormation feature. The tradeoff is that you inherit CloudFormation's quirks: slow operations, resources it doesn't support yet, and stacks that can get stuck in UPDATE_ROLLBACK_FAILED.

Pulumi manages its own state. By default it lives in Pulumi Cloud, but you can point a self-managed backend at S3, Azure Blob Storage, Google Cloud Storage, an S3-compatible server like MinIO, PostgreSQL, or a local directory. You own the state, which means you own locking, backups, and the occasional pulumi refresh to reconcile drift. It's the same operational model Terraform users already know, with the same benefits and the same footguns.

If you want zero state files to babysit, CDK wins. If you want portable state that isn't tied to one cloud's control plane, Pulumi wins.

Deployment speed and rollback

CDK inherits CloudFormation's deployment behavior wholesale, and this is the part teams underestimate. CloudFormation deployments can be slow, and its automatic rollback is a double-edged sword. When an update fails midway, CloudFormation rolls the entire stack back to its last good state. That's safe, but a failed rollback can leave a stack wedged and require manual intervention or stack recreation. Large stacks also hit resource limits and long dependency-resolution times.

Pulumi's engine does a direct diff-and-apply against provider APIs, which is generally faster to reach a plan and start executing. There is no automatic full-stack rollback. If a deployment fails partway, Pulumi stops and leaves already-created resources in place, and you fix forward or destroy explicitly. That's more control and less magic. Neither model is strictly better: CloudFormation's rollback saves you from half-applied states, while Pulumi's fail-in-place avoids the wedged-stack problem.

Language support and testing

CDK supports TypeScript, JavaScript, Python, Java, Go, and C#, generated from a single core via jsii. TypeScript is the first-class citizen and gets features first. Pulumi supports TypeScript, JavaScript, Python, Go, C#, Java, and YAML, with each SDK maintained as a native binding.

For testing, both are genuinely good because it's real code. CDK offers assertion libraries that let you snapshot-test the synthesized template and assert specific resources exist with specific properties. Pulumi supports unit tests with mocked provider calls and property-based checks, plus policy-as-code through CrossGuard. If enforcing "no public S3 buckets" as a test gate matters to you, both deliver, though CDK's template-assertion approach is more mature and widely documented.

Ecosystem, and why CDKTF is off the table

CDK's ecosystem is CloudFormation constructs, including the higher-level L2 and L3 constructs that encode AWS best practices, plus Construct Hub for shared libraries. It's deep on AWS and shallow everywhere else.

Pulumi's ecosystem is its provider registry, which reuses the enormous Terraform provider corpus plus native providers generated directly from cloud API schemas. Broader coverage, less AWS-specific hand-holding.

CDKTF (CDK for Terraform) used to be the middle option: CDK's construct style, synthesized to Terraform. It is gone. HashiCorp sunset the project and archived the terraform-cdk repository on December 10, 2025, so it is read-only and gets no fixes. If you have CDKTF code today, plan a move to plain HCL or to Pulumi, which can convert Terraform projects. Do not start anything new on it.

The comparison at a glance

ToolDeploy engineState lives inCloudsFailed-deploy behaviorStatus (Oct 2026)
AWS CDKCloudFormationCloudFormation stacksAWS onlyAutomatic stack rollbackActive, v2.275.0
PulumiPulumi engine, direct API callsPulumi Cloud or self-managed backendAWS, Azure, GCP, Kubernetes, SaaSStops in place, fix forwardActive, v3.273.0
CDKTFTerraformTerraform stateMulti-cloudTerraform semanticsArchived Dec 10, 2025

Making the call

Choose AWS CDK if you are all-in on AWS and expect to stay there, want CloudFormation to own state so you never touch a state file, and value the deep library of AWS best-practice constructs.

Choose Pulumi if you run more than one cloud, or expect to, want one programming model across AWS, Kubernetes, and SaaS providers, and prefer owning your state backend and deployment engine over inheriting CloudFormation's behavior.

Skip CDKTF entirely. It is archived, and an unmaintained synthesizer between you and your cloud is a liability, not a compromise.

Questions people ask

Is Pulumi better than AWS CDK?

Neither is better in general. AWS CDK is the stronger pick for AWS-only teams because CloudFormation owns state, drift detection and rollback, and the L2 constructs encode AWS defaults. Pulumi is stronger once you touch a second cloud, Kubernetes, or SaaS providers, because one engine and one language cover all of them. The tradeoff is that you operate the Pulumi state backend yourself.

Can Pulumi use AWS CDK constructs?

Yes, through Pulumi's AWS CDK adapter, which lets a Pulumi program instantiate CDK constructs and deploy them with the Pulumi engine instead of CloudFormation; the docs show it in TypeScript. It is useful for reusing an existing construct library during a migration. Treat it as a bridge, not a reason to pick Pulumi: you inherit two abstraction layers and debug both when something fails.

Is CDK for Terraform still supported?

No. HashiCorp announced that CDKTF would sunset and archived the hashicorp/terraform-cdk repository on December 10, 2025. The code stays on GitHub read-only, with no new releases or security fixes. Existing projects should migrate to HCL or another tool such as Pulumi; new projects should not adopt it.

The call we'd make

For a single-cloud AWS shop, we'd reach for CDK. The lack of state to manage and the quality of the AWS constructs pay off every day, and CloudFormation's rollback catches real mistakes.

For anything genuinely multi-cloud, or any team that already runs heavy Kubernetes plus a couple of SaaS providers, we'd pick Pulumi. One language, one engine, one mental model across every provider beats maintaining CDK for AWS and something else for the rest. The state-management responsibility is a fair price for that portability.

For the wider field and where each of these fits, see our guide to the best Infrastructure-as-Code tools. If your real decision is Pulumi against HCL rather than against CDK, our Terraform vs Pulumi comparison digs into that matchup, and Crossplane vs Terraform covers the Kubernetes-native alternative.

Sources

Explore topics:AWSDevOps
React
Share this post
Cite this article
Plain text

Kiril Urbonas (2026). Pulumi vs AWS CDK: Real-Code IaC Compared. DevOpsNess. Updated 2026-11-22. https://www.devopsness.com/blog/pulumi-vs-cdk

Markdown

[Pulumi vs AWS CDK: Real-Code IaC Compared](https://www.devopsness.com/blog/pulumi-vs-cdk) (Kiril Urbonas, DevOpsNess, updated 2026-11-22)

KU

Kiril Urbonas

Founder & Chief Editor

610 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.