AWS SAM for Serverless Apps
Part of the AWS Roadmap
In short
Clicking together functions, APIs and tables in the console is fine once. AWS SAM lets you describe the whole serverless app in one short file, test it on your laptop and deploy it with one command.
The AWS Serverless Application Model is an open-source framework that extends CloudFormation with short syntax for functions, APIs and tables. The SAM CLI builds, tests locally and deploys serverless apps.

Think of it like this
The flat-pack furniture kit
A flat-pack wardrobe comes with a one-page picture guide. You don't get instructions for every screw. 'Shelf' already means four pegs and two brackets. SAM is that short guide: one Function line expands into the function, its role and its trigger, and CloudFormation does the full assembly.
Watch it happen
The SAM workflow
1/5Describe functions, APIs and tables with AWS::Serverless resource types.
The big ideas
What you need to know
A CloudFormation transform
The line Transform: AWS::Serverless-2016-10-31 tells CloudFormation to expand SAM resources. Plain CloudFormation resources still work alongside.
Short resource types
AWS::Serverless::Function, ::HttpApi, ::Api and ::SimpleTable, plus Globals for settings shared by all functions.
Policy templates
Ready-made least-privilege policies such as DynamoDBCrudPolicy scoped to one table.
Local testing
The SAM CLI runs functions in containers that mimic Lambda, so you catch errors before deploying.
See it in code
Walk through the code
1AWSTemplateFormatVersion: "2010-09-09"2Transform: AWS::Serverless-2016-10-313 4Globals:5 Function:6 Runtime: python3.137 Timeout: 108 MemorySize: 2569 10Resources:11 OrdersTable:12 Type: AWS::Serverless::SimpleTable13 14 GetOrdersFunction:15 Type: AWS::Serverless::Function16 Properties:17 CodeUri: src/18 Handler: app.handler19 Environment:20 Variables:21 TABLE_NAME: !Ref OrdersTable22 Policies:23 - DynamoDBReadPolicy:24 TableName: !Ref OrdersTable25 Events:26 GetOrders:27 Type: HttpApi28 Properties:29 Path: /orders30 Method: get1/6The Transform line is what makes this a SAM template.
A SAM template for one function, one table and one HTTP API route. Run sam build, then sam deploy --guided.
Save yourself the pain
Common mistakes
Oops
Editing deployed functions in the console after deploying with SAM.
Do this instead
The next sam deploy overwrites console edits. Change the template and code, then deploy again.
Oops
Giving every function AmazonDynamoDBFullAccess.
Do this instead
Use SAM policy templates scoped to one table, like DynamoDBReadPolicy or DynamoDBCrudPolicy.
Your mission
From init to deployed
Quick check
What actually creates the AWS resources when you run sam deploy?
Go deeper
- 1Run sam init with a Python template and deploy it with sam deploy --guided.
- 2Invoke a function locally with sam local invoke.
- 3Look at the CloudFormation stack SAM creates to see the resources it generated.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.