Nov 9, 20266 min read

AWS SAM Alternatives in 2026

AWS SAM packages Lambda functions and their resources as CloudFormation. These are the alternatives when the templates, local emulation or Lambda itself stop fitting: AWS CDK, SST, the Serverless Framework, Terraform and Encore.

The AWS Serverless Application Model is a CloudFormation extension: AWS::Serverless::Function, Api and SimpleTable resources that expand into Lambda functions, API Gateway, IAM roles and DynamoDB tables, plus the SAM CLI for sam build, sam deploy, sam sync and sam local. It is the default for many Lambda backends because AWS maintains it and it needs nothing beyond CloudFormation.

Teams look for alternatives for one of two reasons: some want to keep Lambda but stop writing YAML, or want a faster development loop than sam local in Docker. Others want to leave Lambda for containers, because of cold starts, the 15 minute limit or database connection handling, and still want infrastructure tied to the code. The options below cover both.

AWS SAM alternatives at a glance

RankOptionComputeYou writeLocal developmentBest fit
1AWS CDKLambda and any AWS resourceTypeScript, Python, Java, C#, GoSAM CLI against synthesized templatesStaying on Lambda, writing code instead of YAML
2SSTLambda, containersTypeScript configLive Lambda against a dev stageTypeScript teams on Lambda
3Serverless FrameworkLambdaserverless.ymlPlugins such as serverless-offlineExisting Serverless users and plugin ecosystems
4TerraformLambda and any resourceHCLSeparate toolingLambda inside a multi-provider IaC setup
5EncoreFargate or EKS containersTypeScript or Go application codeencore run with database, queues, bucketsBackends moving from Lambda to containers

1. AWS CDK

AWS CDK

The AWS CDK is the closest step from SAM, where you define functions with constructs such as NodejsFunction, which bundles TypeScript with esbuild, and wire them to API Gateway, SQS or EventBridge in TypeScript or Python. CDK synthesizes CloudFormation, so deploys, rollbacks and stack limits are unchanged, and SAM CLI can invoke CDK functions locally from the synthesized template.

Best fit: teams staying on Lambda and CloudFormation who want code and constructs instead of YAML.

2. SST

SST

SST defines Lambda functions, containers, buckets and queues in an sst.config.ts file and deploys them through Pulumi and Terraform providers instead of CloudFormation. Its sst dev mode proxies Lambda invocations in a dev stage to your laptop, so code changes take effect without redeploying, against real AWS resources rather than an emulator. Each developer needs a dev stage in an AWS account for that.

Best fit: TypeScript teams on Lambda who want a fast live development loop and frontend deploys in the same tool.

3. Serverless Framework

Serverless Framework

The Serverless Framework describes functions and their events in serverless.yml, generates CloudFormation and has a large plugin ecosystem, including serverless-offline for local API emulation. Version 4 introduced a subscription for organizations above a revenue threshold, which has pushed some teams to re-evaluate. The configuration is shorter than SAM for common cases, and still YAML with CloudFormation underneath.

Best fit: teams already invested in Serverless Framework plugins, or deploying Lambda in several languages from one config format.

4. Terraform

Terraform

Terraform can deploy Lambda functions, API Gateway routes and event source mappings like any other resource, alongside non-AWS providers. Packaging code is your job, usually a CI step that builds a zip or image and passes its hash to Terraform, and there is no local invoke tooling. It fits when Lambda is a small part of a larger infrastructure codebase already in Terraform.

Best fit: platform teams managing Lambda as one part of a multi-provider Terraform setup.

5. Encore

Encore

Encore combines an open source infrastructure SDK with a platform that provisions and deploys into your own AWS or GCP account. For TypeScript and Go it is a backend framework with built-in infrastructure: endpoints, databases, Pub/Sub, buckets, caches and cron jobs are declared in the application code, and the Encore platform provisions them on deploy. Services run as containers on Fargate or EKS, not as Lambda functions.

A SAM function handling an API route and its table becomes an endpoint and a database:

import { api, APIError } from "encore.dev/api"; import { SQLDatabase } from "encore.dev/storage/sqldb"; // RDS for PostgreSQL on AWS. `encore run` starts Postgres locally. const db = new SQLDatabase("todos", { migrations: "./migrations" }); interface Todo { id: number; title: string; } export const create = api( { expose: true, method: "POST", path: "/todos" }, async ({ title }: { title: string }): Promise<Todo> => { const row = await db.queryRow<Todo>` INSERT INTO todos (title) VALUES (${title}) RETURNING id, title`; return row!; }, ); export const get = api( { expose: true, method: "GET", path: "/todos/:id" }, async ({ id }: { id: number }): Promise<Todo> => { const row = await db.queryRow<Todo>`SELECT id, title FROM todos WHERE id = ${id}`; if (!row) throw APIError.notFound("todo not found"); return row; }, );

There is no template and no API Gateway definition: the route, the request type and the database come from the code. encore run starts Postgres locally, along with any Pub/Sub topics and buckets, so the whole backend runs on a laptop, not only the function handler. On deploy to your own AWS account, Encore provisions Fargate behind an Application Load Balancer, RDS, SNS and SQS for queues, and S3, as listed in the AWS infrastructure docs, and it provisions an IAM role for the service. Long-running requests, connection pools and background subscribers behave as in any server, with no cold starts.

Containers run continuously, so a backend with very low or very spiky traffic pays for idle capacity that Lambda would not bill. SAM-specific event sources such as S3 notifications or DynamoDB streams have no Encore declaration, and those parts stay in Lambda or move to Pub/Sub. The TypeScript docs cover the full set of primitives.

Best fit: teams leaving Lambda because of cold starts, timeouts or database connections, who want the backend as containers in their own AWS account with the database, queues and schedules declared in TypeScript or Go.

How to choose

The first decision is whether you are keeping Lambda. If you are, pick CDK to stay on CloudFormation with real languages, SST for a fast TypeScript development loop, the Serverless Framework if your team relies on its plugins, and Terraform when Lambda sits inside an existing Terraform codebase. If Lambda itself is the problem (cold starts, the 15 minute limit or database connections), Encore runs the backend as containers on Fargate or EKS in your own AWS account, with the database, queues and buckets declared in the application code.

Frequently asked questions

What is the best alternative to AWS SAM?

AWS CDK for teams that want to keep Lambda and CloudFormation but write TypeScript or Python instead of YAML, SST for TypeScript teams that want fast live Lambda development, the Serverless Framework for its plugin ecosystem and multi-language Lambda support, and Terraform when Lambda is one part of a larger multi-provider setup. Teams moving off Lambda to containers look at tools that provision Fargate instead.

Is AWS CDK better than SAM?

CDK is more flexible, since it covers every AWS resource with code in TypeScript, Python, Java, C# or Go and offers higher-level constructs, while SAM is a shorter YAML syntax focused on serverless resources. Both deploy through CloudFormation, and SAM CLI commands such as sam local invoke can also run against CDK apps.

Does Encore deploy to AWS Lambda?

Encore deploys services as containers on Fargate or EKS in your own AWS account, not as Lambda functions. It fits SAM users who want local development of the whole backend, with databases, queues, buckets and cron declared in TypeScript or Go, and are open to always-on containers instead of per-request functions.

Why do teams move away from AWS SAM?

Common reasons are large YAML templates with intrinsic functions, slow CloudFormation deploys and rollbacks, sam local relying on Docker and emulating only Lambda and API Gateway rather than queues and databases, and Lambda limits such as cold starts, the 15 minute timeout and per-invocation database connections.

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.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders