Developer Tools · head to head
AWS CloudFormation vs AWS Serverless Application Model (AWS SAM)

AWS CloudFormation
Developer Tools
Declarative infrastructure as code for AWS, free for AWS resources
- From
- Free
- Free plan
- Yes

AWS Serverless Application Model (AWS SAM)
Developer Tools
Open-source framework and CLI for building serverless apps on AWS
- From
- Free
- Free plan
- Yes
The short version
- Both are free.
- Only AWS CloudFormation lists stacks and templates; only AWS Serverless Application Model (AWS SAM) lists SAM connectors for IAM permissions.
- Where AWS CloudFormation falls short: it only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it.
- Where AWS Serverless Application Model (AWS SAM) falls short: targets AWS only, so templates are not portable to other cloud providers.
How do AWS CloudFormation and AWS Serverless Application Model (AWS SAM) differ?
AWS CloudFormation and AWS Serverless Application Model (AWS SAM) differ on pricing model and platforms. Only the attributes on which AWS CloudFormation and AWS Serverless Application Model (AWS SAM) actually diverge.
| Attribute | AWS CloudFormation | AWS Serverless Application Model (AWS SAM) |
|---|---|---|
| Pricing model | No charge for AWS resource types; extensions per handler operation | Open-source |
| Platforms | Web, Linux, macOS, Windows | Windows, macOS, Linux |
Identical on both: starting price (Free), free tier (Yes).
Not yet recorded: category for AWS CloudFormation.
Which features does each one have?
They share no listed features; 6 appear only for AWS CloudFormation and 7 only for AWS Serverless Application Model (AWS SAM). Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.
Only in AWS CloudFormation
- Stacks and templates
- Change sets
- Drift detection
- StackSets
- Rollback
- Registry extensions
Only in AWS Serverless Application Model (AWS SAM)
- SAM template shorthand for CloudFormation
- SAM CLI project scaffolding with sam init
- Local testing of Lambda functions and API endpoints
- sam sync for syncing local changes to the cloud
- SAM connectors for IAM permissions
- Terraform project debugging support
- CI/CD pipeline support
What is each one used for?
AWS CloudFormation is most often brought in for recreating identical dev, staging and production environments on AWS; AWS Serverless Application Model (AWS SAM) for defining Lambda and API Gateway applications as code. The jobs each tool is most often brought in to do.
AWS CloudFormation
- Recreating identical dev, staging and production environments on AWSnot AWS Serverless Application Model (AWS SAM)
- Deploying one baseline of security resources across many accounts with StackSetsnot AWS Serverless Application Model (AWS SAM)
- Serverless applications packaged with AWS SAMnot AWS Serverless Application Model (AWS SAM)
- Previewing and auditing infrastructure changes through change setsnot AWS Serverless Application Model (AWS SAM)
AWS Serverless Application Model (AWS SAM)
- Defining Lambda and API Gateway applications as codenot AWS CloudFormation
- Testing Lambda functions locally before deploymentnot AWS CloudFormation
- Building CI/CD pipelines for serverless appsnot AWS CloudFormation
- Converting console-created resources into templatesnot AWS CloudFormation
Where do AWS CloudFormation and AWS Serverless Application Model (AWS SAM) fall short?
AWS CloudFormation's most cited limit: it only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it. AWS Serverless Application Model (AWS SAM)'s: targets AWS only, so templates are not portable to other cloud providers. Documented limitations, not opinions. Every one is a constraint you would hit in normal use.
AWS CloudFormation
- It only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it
- Raw templates are verbose and hard to reuse, which is why many teams add CDK on top
- A failed update can leave a stack in a stuck state such as UPDATE_ROLLBACK_FAILED that needs manual intervention
- New AWS features sometimes arrive in CloudFormation after the console and API, so you wait or script around the gap
- Deleting a stack deletes its resources, so a mistaken delete of a stack with data needs DeletionPolicy discipline
AWS Serverless Application Model (AWS SAM)
- Targets AWS only, so templates are not portable to other cloud providers
- Local testing of functions depends on Docker being installed and running
- Requires an AWS account, the AWS CLI and configured credentials before first use
- Declarative templates, so complex logic needs CloudFormation or the AWS CDK instead
- Does not cover non-serverless infrastructure on its own, which falls back to CloudFormation
How much do AWS CloudFormation and AWS Serverless Application Model (AWS SAM) cost?
AWS CloudFormation is free to use; AWS Serverless Application Model (AWS SAM) is free to use. Plan by plan below, from each vendor's own pricing page.
AWS CloudFormation
Free- AWS resource typesFree
- No additional charge for using CloudFormation with AWS resources
- You pay for the resources the stack creates
- Third-party extensionsOn request
- $0.0009 per handler operation, first 1,000 per month free
- $0.00008 per second of handler duration beyond 30 seconds
AWS Serverless Application Model (AWS SAM)
FreeNo published plan breakdown. See the AWS Serverless Application Model (AWS SAM) review.
Which should you pick?
Choose AWS CloudFormation if
- You need stacks and templates.
- You want to start without paying.
- You work on Web, Linux, macOS, Windows.
- You also want change sets.
Choose AWS Serverless Application Model (AWS SAM) if
- You need sam template shorthand for cloudformation.
- You want to start without paying.
- You work on Windows, macOS, Linux.
- You also want sam cli project scaffolding with sam init.
Questions people ask
- Is AWS CloudFormation or AWS Serverless Application Model (AWS SAM) better?
- It depends on the job. AWS CloudFormation fits recreating identical dev, staging and production environments on AWS; AWS Serverless Application Model (AWS SAM) fits defining Lambda and API Gateway applications as code. AWS CloudFormation starts at Free and AWS Serverless Application Model (AWS SAM) at Free.
- Which is cheaper, AWS CloudFormation or AWS Serverless Application Model (AWS SAM)?
- AWS CloudFormation starts at Free and AWS Serverless Application Model (AWS SAM) at Free.
- Does AWS CloudFormation or AWS Serverless Application Model (AWS SAM) run on more platforms?
- AWS CloudFormation runs on Web, Linux, macOS, Windows. AWS Serverless Application Model (AWS SAM) runs on Windows, macOS, Linux.
- Can I use AWS CloudFormation for free?
- Both have a free tier, so you can try either at no cost before committing.
- What is AWS CloudFormation best used for?
- AWS CloudFormation is most often used for recreating identical dev, staging and production environments on aws, deploying one baseline of security resources across many accounts with stacksets, serverless applications packaged with aws sam, previewing and auditing infrastructure changes through change sets. Of those, recreating identical dev, staging and production environments on aws and deploying one baseline of security resources across many accounts with stacksets are not what AWS Serverless Application Model (AWS SAM) is typically brought in for.
- What can AWS CloudFormation do that AWS Serverless Application Model (AWS SAM) cannot?
- AWS CloudFormation covers Stacks and templates, Change sets, Drift detection, StackSets. AWS Serverless Application Model (AWS SAM) covers SAM template shorthand for CloudFormation, SAM CLI project scaffolding with sam init, Local testing of Lambda functions and API endpoints, sam sync for syncing local changes to the cloud.
Answered from the vendors’ own pages
AWS CloudFormation: Does CloudFormation cost money?
Not for AWS resource types. You pay for the resources it creates; third-party extensions are billed at $0.0009 per handler operation after 1,000 free.
AWS Serverless Application Model (AWS SAM): What is AWS SAM?
AWS SAM is an open-source framework for building serverless applications with infrastructure as code. It consists of a template syntax that extends CloudFormation and a command-line tool.
SourceAWS CloudFormation: CloudFormation or Terraform?
CloudFormation is AWS-only with state managed by AWS; Terraform spans many providers and keeps its own state.
AWS Serverless Application Model (AWS SAM): Which operating systems does the SAM CLI support?
AWS publishes installers for Linux on x86_64 and arm64, macOS on Intel and Apple silicon, and a 64-bit Windows MSI. macOS versions older than 13.x are not supported.
SourceAWS CloudFormation: How does CDK relate?
CDK lets you write infrastructure in a programming language and synthesises CloudFormation templates.
AWS Serverless Application Model (AWS SAM): What licence does AWS SAM use?
The serverless-application-model repository on GitHub is licensed under Apache-2.0.
SourceAWS Serverless Application Model (AWS SAM): How does SAM differ from the AWS CDK?
The documentation says to use SAM instead of the CDK if you prefer a declarative approach to describing infrastructure rather than a programmatic one. The two can also be combined, using the SAM CLI's local testing with CDK applications.
SourceRelated pages
More on AWS CloudFormation
More on AWS Serverless Application Model (AWS SAM)
Other head to heads
- AWS CloudFormation vs Terraform
- AWS CloudFormation vs Spacelift
- AWS CloudFormation vs env zero
- AWS CloudFormation vs Atlantis
- AWS CloudFormation vs LocalStack
- AWS CloudFormation vs Coder
- AWS CloudFormation vs Tilt
- AWS CloudFormation vs Harness
- AWS CloudFormation vs Argo CD
- AWS CloudFormation vs Envoy
- AWS CloudFormation vs HCP Terraform
- AWS CloudFormation vs Daytona
- AWS CloudFormation vs Xlinesoft
- AWS CloudFormation vs GitHub Copilot
- AWS CloudFormation vs Visual Studio Code
- AWS CloudFormation vs Kubernetes
- AWS CloudFormation vs Claude Code
- AWS CloudFormation vs Docker
- AWS CloudFormation vs Cloudflare Workers
- AWS CloudFormation vs Backstage
- AWS CloudFormation vs PDAL
- AWS CloudFormation vs Losant
- AWS CloudFormation vs PartyKit
- AWS CloudFormation vs Swagger UI
- AWS CloudFormation vs Warp
- AWS CloudFormation vs Cloud Native Buildpacks
- AWS CloudFormation vs ConfigCat
- AWS CloudFormation vs GitHub Codespaces
- AWS CloudFormation vs GitHub Desktop
- AWS Serverless Application Model (AWS SAM) vs Terraform
- AWS Serverless Application Model (AWS SAM) vs Spacelift
- AWS Serverless Application Model (AWS SAM) vs env zero
- AWS Serverless Application Model (AWS SAM) vs Atlantis
- AWS Serverless Application Model (AWS SAM) vs LocalStack
- AWS Serverless Application Model (AWS SAM) vs Coder
- AWS Serverless Application Model (AWS SAM) vs Tilt
- AWS Serverless Application Model (AWS SAM) vs Harness
- AWS Serverless Application Model (AWS SAM) vs Argo CD
- AWS Serverless Application Model (AWS SAM) vs Envoy
- AWS Serverless Application Model (AWS SAM) vs HCP Terraform
- AWS Serverless Application Model (AWS SAM) vs Daytona
- AWS Serverless Application Model (AWS SAM) vs Xlinesoft
- AWS Serverless Application Model (AWS SAM) vs GitHub Copilot
- AWS Serverless Application Model (AWS SAM) vs Visual Studio Code
- AWS Serverless Application Model (AWS SAM) vs Kubernetes
- AWS Serverless Application Model (AWS SAM) vs Claude Code
- AWS Serverless Application Model (AWS SAM) vs Docker
- AWS Serverless Application Model (AWS SAM) vs Cloudflare Workers
- AWS Serverless Application Model (AWS SAM) vs Backstage
- AWS Serverless Application Model (AWS SAM) vs PDAL
- AWS Serverless Application Model (AWS SAM) vs Losant
- AWS Serverless Application Model (AWS SAM) vs PartyKit
- AWS Serverless Application Model (AWS SAM) vs Swagger UI
- AWS Serverless Application Model (AWS SAM) vs Warp
- AWS Serverless Application Model (AWS SAM) vs Cloud Native Buildpacks
- AWS Serverless Application Model (AWS SAM) vs ConfigCat
- AWS Serverless Application Model (AWS SAM) vs GitHub Codespaces
- AWS Serverless Application Model (AWS SAM) vs GitHub Desktop
