aws /serverless-application-model
The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
★ 9,586⑂ 2,462👁 266⑃ 2,300● 1,415▤ 124
+0
日增长
9,586
stars
2,462
forks
266
watchers
2,300
prs
1,415
issues
124
releases
README
AWS SAM transform
The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.
To use the SAM transform, add AWS::Serverless-2016-10-31 to the Transform section of your CloudFormation template.
Benefits of using the SAM transform include:
- Built-in best practices and sane defaults.
- Local testing and debugging with the AWS SAM CLI.
- Extension of the CloudFormation template syntax.
Getting started
Save the following as template.yaml:
yaml
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: nodejs24.x
Handler: index.handler
InlineCode: |
exports.handler = async (event) = {
console.log(event);
}
And deploy it with the SAM CLI:
bash
sam sync --stack-name sam-app
The AWS::Serverless::Function resource will create a AWS Lambda function that logs events it receives.
Under the hood, the template is transformed into the JSON equivalent of the following CloudFormation template:
yaml
Resources:
MyFunction:
Type: AWS::Lambda::Function
Properties:
Code:
ZipFile: |
exports.handler = async (event) = {
console.log(event);
}
Handler: index.handler
Role: !GetAtt MyFunctionRole.Arn
Runtime: nodejs24.x
Tags:
- Key: lambda:createdBy
Value: SAM
MyFunctionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
ManagedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Tags:
- Key: lambda:createdBy
Value: SAM
For a more thorough introduction, see the this tutorial in the Developer Guide.
Contributing
Setting up development environment
You'll need to have Python 3.8+ installed.
Create a virtual environment:
bash
python3 -m venv .venv
source .venv/bin/activate
Set up dependencies:
bash
make init
Run tests:
bash
make pr
See DEVELOPMENT_GUIDE.md for further development instructions, and CONTRIBUTING.md for the contributing guidelines.
Getting help
The best way to interact with the team is through GitHub. You can either create an issue or start a discussion.
You can also join the samdev channel on Slack.
Learn more
Workshops and tutorials
- The Complete AWS SAM Workshop
- AWS Serverless Developer Experience Workshop
- Deploying a "Hello, World!" application
- Testing in the cloud using the SAM CLI
Documentation
- SAM Developer Guide
- SAM template specification
- SAM connectors
- SAM policy templatesTop issues
#192BasePathMapping deployment error: Invalid stage identifier specified33 comments · 2017-09-01#2533Unsupported intrinsic functions27 comments · 2022-10-11#337The final policy size is bigger than the limit25 comments · 2018-03-20#2481Unable to set authorizer on AWS::Serverless::HttpApi on $default path19 comments · 2021-01-09#792Support WAF for API Gateway16 comments · 2019-02-04#2211Create apigateway permissions from openapi definitions14 comments · 2021-11-05#1239AWS::Serverless::Api Tags are not visible in the API Gateway console under "Configure Tags"13 comments · 2019-11-12#553Unable to set "contentHandling"13 comments · 2018-08-24
Discussions
#3832AWS Toolkit YAML editing cababilities beyond Red Hat YAML in VS Code?0 comments · 2025-10-21#3759Function: (BuildMethod/Metadata: BuildMethod): makefile0 comments · 2025-04-20#3749Feature Request: API Gateway Direct Resolvers (AppSync-style without VTL)0 comments · 2025-04-09#3722Docs: Which documentation should be the latest?0 comments · 2025-02-20#3697Installation method - pip or installer?0 comments · 2024-12-17#3609(New Connector Profile) AWS::ApiGateway::RestApi > AWS::Serverless::StateMachine1 comments · 2024-06-04#3612Bug: Lambda function (with alias) doesn't create a new version after its layer is updated, even if `AutoPublishAliasAllProperties` is set to `true`9 comments · 2024-05-31#3607(New Connector Profile) AWS Batch1 comments · 2024-05-27
Latest release
SAM v1.116.0 Release v1.116.0 2026-10-30What's Changed Release 1.116.0 (to main) by @Vandita2020 in https://github.com/aws/serverless-application-model/pull/4027 Full Changelog: https://github.com/aws/serverless-application-model/compare/v1.115.0...v1.116.0