Six alternatives to AWS CDK, ranked, with current versions, the same orders service in CDK and Encore, and when each one is the better choice.

The best AWS CDK alternative for a TypeScript or Go backend team is Encore, which takes the separate infrastructure app out of the picture: the Postgres databases, Pub/Sub topics, buckets, cron jobs and secrets are declared in the backend code, and Encore provisions them in your own AWS or GCP account, with no CloudFormation stack in between. If you want to keep a separate infrastructure program, Pulumi is the closest replacement for CDK without CloudFormation. Terraform or OpenTofu make sense when your team already runs HCL, SST fits Lambda-heavy AWS apps with a frontend, and AWS SAM or Serverless Framework fit small Lambda projects.
CDK made AWS infrastructure much nicer to write than raw CloudFormation, and the L2 constructs cover a lot of ground. The friction comes from CloudFormation underneath: every cdk deploy is a CloudFormation deployment, so you inherit its speed, its rollback behavior and its 500-resource limit per stack, which counts the IAM roles and log groups CDK adds for you as well as the resources you wrote. When a construct does not expose the property you need, you reach for node.defaultChild and addPropertyOverride. And the CDK app is a second codebase: the backend reads queue URLs and table names from environment variables that the stack has to pass in correctly.
UPDATE_ROLLBACK_FAILED.The ranking is for application teams: the further down the list, the more infrastructure code you still write and maintain next to the backend. Release numbers are from each project's GitHub releases.
Encore is infrastructure from code for TypeScript and Go. A CDK construct describes an AWS resource inside a separate app that synthesizes a CloudFormation template. An Encore declaration describes a resource the backend uses, in the file that uses it, and Encore works out the cloud resources, networking and IAM from that. There is no stack to synthesize, and nothing to pass from the stack to the application through environment variables.

Here is an orders service in CDK: a VPC, a Postgres instance, a queue with a dead-letter queue, a bucket and a Fargate service that gets their addresses and permissions passed in.
// lib/orders-stack.ts (aws-cdk-lib 2.276.0)
import { Stack, StackProps, Duration } from "aws-cdk-lib";
import { Construct } from "constructs";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import * as rds from "aws-cdk-lib/aws-rds";
import * as sqs from "aws-cdk-lib/aws-sqs";
import * as s3 from "aws-cdk-lib/aws-s3";
import * as ecs from "aws-cdk-lib/aws-ecs";
import * as ecsPatterns from "aws-cdk-lib/aws-ecs-patterns";
export class OrdersStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const vpc = new ec2.Vpc(this, "Vpc", { maxAzs: 2 });
const db = new rds.DatabaseInstance(this, "OrdersDb", {
engine: rds.DatabaseInstanceEngine.postgres({
version: rds.PostgresEngineVersion.VER_18_3,
}),
vpc,
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
credentials: rds.Credentials.fromGeneratedSecret("orders_admin"),
});
const dlq = new sqs.Queue(this, "OrderEventsDlq");
const queue = new sqs.Queue(this, "OrderEvents", {
visibilityTimeout: Duration.seconds(60),
deadLetterQueue: { queue: dlq, maxReceiveCount: 5 },
});
const receipts = new s3.Bucket(this, "Receipts", {
blockPublicAccess: s3.BlockPublicAccess.BLOCK_ALL,
});
const service = new ecsPatterns.ApplicationLoadBalancedFargateService(this, "Api", {
cluster: new ecs.Cluster(this, "Cluster", { vpc }),
taskImageOptions: {
image: ecs.ContainerImage.fromAsset("../app"),
environment: {
DB_HOST: db.dbInstanceEndpointAddress,
QUEUE_URL: queue.queueUrl,
RECEIPTS_BUCKET: receipts.bucketName,
},
secrets: {
DB_SECRET: ecs.Secret.fromSecretsManager(db.secret!),
},
},
});
db.connections.allowDefaultPortFrom(service.service);
queue.grantSendMessages(service.taskDefinition.taskRole);
queue.grantConsumeMessages(service.taskDefinition.taskRole);
receipts.grantReadWrite(service.taskDefinition.taskRole);
}
}
DB_HOST, QUEUE_URL and RECEIPTS_BUCKET from the environment, and an hourly job would need an EventBridge rule and a target on top.The same service in Encore is the application code itself:
// orders/orders.ts (encore.dev 1.58)
import { api } from "encore.dev/api";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic, Subscription } from "encore.dev/pubsub";
import { Bucket } from "encore.dev/storage/objects";
import { CronJob } from "encore.dev/cron";
// Postgres: RDS in your AWS account, a local database on `encore run`.
const db = new SQLDatabase("orders", { migrations: "./migrations" });
// SNS topic with an SQS queue per subscription, dead-letter queue included.
export const orderPlaced = new Topic<{ orderId: string }>("order-placed", {
deliveryGuarantee: "at-least-once",
});
// S3 bucket; the service gets read/write access to this bucket only.
const receipts = new Bucket("receipts", { versioned: false });
export const placeOrder = api(
{ method: "POST", path: "/orders", expose: true },
async ({ orderId }: { orderId: string }): Promise<void> => {
await db.exec`INSERT INTO orders (id, status) VALUES (${orderId}, 'placed')`;
await orderPlaced.publish({ orderId });
},
);
const _ = new Subscription(orderPlaced, "write-receipt", {
handler: async ({ orderId }) => {
await receipts.upload(`${orderId}.json`, Buffer.from(JSON.stringify({ orderId })), {
contentType: "application/json",
});
},
});
// Called on schedule by the Encore platform; no scheduler resource to define.
export const expireUnpaid = api({}, async (): Promise<void> => {
await db.exec`
UPDATE orders SET status = 'expired'
WHERE status = 'placed' AND created_at < NOW() - INTERVAL '1 day'`;
});
const expire = new CronJob("expire-unpaid", {
title: "Expire unpaid orders",
every: "1h",
endpoint: expireUnpaid,
});
encore run starts the service with a local Postgres database, topic and bucket. A deploy to AWS creates RDS, SNS with SQS and a dead-letter queue, and S3 in your account.On AWS, the Encore platform runs the service on Fargate or EKS in a VPC it creates per environment and puts the database in private subnets. Encore provisions an IAM role for the service, or a service account on GCP. The Encore platform runs the cron job on its schedule. Instance sizes, networking and backups are set per environment rather than in the code, and when the app is connected to GitHub, preview environments can give each pull request its own copy of the declared resources.
The same model applies when AI agents ship backend changes to your cloud. An agent that adds a bucket declares it next to the code that writes to it, runs it locally with encore run, and the deploy creates the bucket. Cloud access sits with Encore's IAM role, not the agent, and there is no second pull request against a CDK app to get right.
encore run.encore build docker produces a standard image if you would rather deploy it yourself.Encore does not read a CDK construct tree or adopt a CloudFormation stack. Encore's CDK migration guide suggests leaving account setup, VPCs, DNS, shared networking, custom resources and AWS services without an Encore primitive in CDK, and moving one service at a time. Existing RDS databases, S3 buckets and SNS topics can be connected to Encore declarations. Before handing a resource over, set its CDK removal policy to RETAIN, deploy, then remove the construct so CloudFormation stops managing it without deleting it.
Encore covers backends written in TypeScript and Go and deploys to AWS and GCP. If most of your CDK code is account-level infrastructure, or you rely on services like Step Functions and DynamoDB, those stay in CDK and your backend calls them through the AWS SDK. Cron jobs do not run on their schedule locally or in preview environments, so you call the endpoint directly to test them.
See how infrastructure from code works in Encore.
Run in your terminal to get started locally.
Yes, if you want to keep the CDK model of a separate infrastructure program in a general-purpose language. Pulumi programs are written in TypeScript, Python, Go, C#, Java or YAML, and the Pulumi engine calls the cloud providers directly, so there is no CloudFormation template and no 500-resource stack limit.
import * as aws from "@pulumi/aws";
const dlq = new aws.sqs.Queue("order-events-dlq");
const queue = new aws.sqs.Queue("order-events", {
visibilityTimeoutSeconds: 60,
redrivePolicy: dlq.arn.apply((arn) =>
JSON.stringify({ deadLetterTargetArn: arn, maxReceiveCount: 5 }),
),
});
export const queueUrl = queue.url;
Pulumi works across AWS, GCP, Azure and Kubernetes, and CDK on Pulumi lets you reuse existing CDK constructs during a migration. The tradeoff is that state moves from CloudFormation to Pulumi Cloud or a backend you run, and the infrastructure is still a separate program from the backend that uses it.
When your organization already has Terraform modules, a platform team that owns them, or infrastructure across many providers. Terraform has been under the Business Source License since 2023, and OpenTofu is the MPL-2.0 fork run under the Linux Foundation. Both use HCL and a state file you store and lock yourself, usually in S3.
resource "aws_sqs_queue" "order_events_dlq" {
name = "order-events-dlq"
}
resource "aws_sqs_queue" "order_events" {
name = "order-events"
visibility_timeout_seconds = 60
redrive_policy = jsonencode({
deadLetterTargetArn = aws_sqs_queue.order_events_dlq.arn
maxReceiveCount = 5
})
}
If you were looking at CDK for Terraform as the middle ground, note that HashiCorp deprecated CDKTF on December 10, 2025 and archived the project. The Terraform alternatives guide covers the HCL side in more depth.
For AWS apps built around Lambda, containers and a web frontend, yes. Earlier versions of SST were built on CDK, but current SST uses Pulumi behind the scenes and defines the whole app in one sst.config.ts with components like sst.aws.Postgres, sst.aws.Bucket and sst.aws.Cron. link passes resources to your functions and services, and sst dev runs functions live against real AWS resources.
const bucket = new sst.aws.Bucket("Receipts");
new sst.aws.Function("PlaceOrder", {
handler: "src/orders.handler",
link: [bucket],
url: true,
});
SST is strongest for frontends such as Next.js plus serverless backends on AWS. The infrastructure is still a config file next to the app rather than part of the backend code, and you write the VPC and component settings yourself. Our SST alternatives guide compares it in more detail.
AWS SAM is AWS's own shorthand for serverless CloudFormation. A SAM template expands AWS::Serverless::Function and friends into full CloudFormation, and the SAM CLI runs Lambda functions and API Gateway locally in Docker.
Transform: AWS::Serverless-2016-10-31
Resources:
PlaceOrder:
Type: AWS::Serverless::Function
Properties:
Handler: orders.handler
Runtime: nodejs22.x
Events:
Api:
Type: HttpApi
Properties:
Path: /orders
Method: post
SAM is a good fit for a handful of functions where official AWS tooling matters more than ergonomics. It is still CloudFormation, so it has the same deploy behavior and limits as CDK, and anything beyond functions and APIs is plain CloudFormation YAML.
Serverless Framework predates CDK and describes Lambda functions and their events in serverless.yml, which it compiles to CloudFormation. From version 4, the CLI is free for individuals and organizations under $2M in annual revenue, and larger organizations need a paid subscription. Version 3 remains open source but is no longer maintained.
It makes sense for teams that already have Lambda services on it and are not feeling pain. For a new project, SAM, SST or one of the options above are easier to justify.
Do you want the database, queue and bucket declared in the backend code instead of a separate infrastructure app?
Do you want to keep a separate infrastructure program in TypeScript, Python or Go, without CloudFormation?
Do you already have Terraform modules or a platform team that owns HCL?
Is the app mostly Lambda functions and a web frontend on AWS?
Is it a handful of Lambda functions and you want official AWS tooling?
Are you AWS only and not hitting CloudFormation's limits?
Verdict. If you are leaving CDK because of CloudFormation but want to keep writing infrastructure as a separate program, Pulumi is the most direct move. If the problem is that every backend change needs a matching change in a second codebase, Encore ranks first, because the database, topic, bucket and cron job are declared in the code that uses them and Encore provisions them in your account. CDK can keep the VPCs, DNS and shared resources while you move one service at a time. Start with the quickstart to see what encore run gives you locally.
For TypeScript and Go backend teams, Encore is the best AWS CDK alternative: you declare the Postgres databases, Pub/Sub topics, buckets, caches, cron jobs and secrets in the application, and Encore provisions them in your own AWS or GCP account without a separate CDK app or CloudFormation stack. Pulumi is the closest like-for-like replacement if you want to keep a separate infrastructure program in TypeScript, Python or Go without CloudFormation. Terraform or OpenTofu fit teams with existing HCL, SST fits AWS apps built around Lambda and frontends, and AWS SAM fits small Lambda projects.
The common reasons are CloudFormation underneath CDK: slow deploys, rollbacks that can leave a stack in UPDATE_ROLLBACK_FAILED, the 500-resource limit per stack, and escape hatches when an L2 construct does not expose a property. CDK is also AWS only, and the infrastructure lives in a separate app that has to be kept in step with the backend code that uses it.
No. HashiCorp deprecated CDK for Terraform on December 10, 2025 and archived the repository, so it gets no fixes or compatibility updates. HashiCorp recommends exporting projects with cdktf synth --hcl and continuing with Terraform HCL.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.