AWS SAM
Learn how AWS SAM builds, tests, and deploys serverless applications with a CloudFormation extension and local tooling.
AWS SAM is the Serverless Application Model for AWS and extends CloudFormation with serverless-specific resource types and workflows. For DevOps teams, it matters because it helps teams package Lambda functions, APIs, and DynamoDB tables into a focused serverless deployment experience. Instead of relying on one fragile manual configuration, you can design a repeatable service boundary that stays stable while the workload behind it changes.
Core ideas
The main ideas to understand are SAM templates introduce resource types such as AWS::Serverless::Function, API, and Table to reduce boilerplate; sam init creates a starter project, while sam local invoke and sam local start-api support local testing loops; sam deploy handles packaging and deployment into AWS with CloudFormation under the hood; and SAM sits between raw CloudFormation and broader frameworks, making it attractive for teams that mainly build AWS-native serverless systems. These details shape architecture decisions, but they also shape day-to-day operations. When a team chooses defaults without understanding how the service behaves under failure, scale, or security review, the platform often becomes harder to debug than the application itself.
| Framework | Best fit | Notes |
|---|---|---|
| SAM | AWS-native serverless apps | Focused on Lambda, APIs, and events |
| CDK | Programmable IaC | Broader abstraction options |
| Serverless Framework | Multi-provider workflows | Different ecosystem and plugins |
From an operations perspective, the goal is to use the simplified serverless syntax without forgetting that deployed changes still become CloudFormation stacks that need normal review. The comparison below highlights the choices that usually matter first. It is often better to start with a simpler design and add sophistication only after metrics, incidents, or delivery requirements prove the change is necessary.
Practical commands
sam init
sam local invoke
sam local start-api
sam deploy --guided
Practical CLI checks make the service easier to support in real environments. Use the commands below to inspect the current state and confirm that automation matches intent. Before you promote a change, verify local event tests, IAM policies, and generated stack changes before promoting a serverless application update. A safe default is keep templates small and event definitions explicit so function ownership and triggers remain easy to audit. That discipline makes later troubleshooting, scaling, and security reviews far less painful.
SAM role
What is AWS SAM?
Local testing
Which SAM command can run a Lambda function locally for testing?