AWS Serverless Application Model
Build serverless applications in simple and clean syntax
The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. It provides shorthand syntax to express functions, APIs, databases, and event source mappings. With just a few lines per resource, you can define the application you want and model it using YAML. During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax, enabling you to build serverless applications faster.
To get started with building SAM-based applications, use the AWS SAM CLI. SAM CLI provides a Lambda-like execution environment that lets you locally build, test, and debug applications defined by SAM templates or through the AWS Cloud Development Kit (CDK). You can also use the SAM CLI to deploy your applications to AWS, or create secure continuous integration and deployment (CI/CD) pipelines that follow best practices and integrate with AWS' native and third party CI/CD systems.
SAM and SAM CLI are open-sourced under the Apache 2.0 license. You can contribute new features and enhancements to SAM on GitHub or SAM CLI on GitHub.
Getting Started with SAM
Install SAM CLI
Install SAM CLI using Brew
brew tap aws/tap
brew install aws-sam-cli
Install SAM CLI by downloading a ZIP file
Install SAM CLI using an MSI
Use AWS SAM CLI to build and test applications defined using AWS CDK.
Requires Node Package Manager. See installation instructions
Single Deployment Configuration
Use SAM to organize related components, share configuration such as memory and timeouts between resources, and deploy all related resources together as a single, versioned entity.
Integration with Development Tools
SAM integrates with a suite of AWS serverless tools. Find new applications in the AWS Serverless Application Repository, use AWS Cloud9 IDE to author, test, and debug SAM-based serverless applications, and AWS CodeBuild, AWS CodeDeploy, and AWS CodePipeline to build a deployment pipeline. To start with a project structure, code repository, and CI/CD pipeline configured for you, try AWS CodeStar.
Local Testing and Debugging
Use SAM CLI to step-through and debug your code. It provides a Lambda-like execution environment locally and helps you catch issues upfront.
Built on AWS CloudFormation
AWS SAM is an extension of AWS CloudFormation, so you get the reliable deployment capabilities of CloudFormation. You can also define resources using CloudFormation in your SAM template and use the full suite of resources, intrinsic functions, and other template features that are available in AWS CloudFormation.
Built-In Best Practices
Deploy your infrastructure as config to leverage best practices such as code reviews. Enable gradual deployments through AWS CodeDeploy and tracing using AWS X-Ray with just a few lines of SAM config.
Contribute to SAM
Make pull requests, report bugs, and share ideas to improve the full AWS SAM template specification
Add new commands or enhance existing ones, report bugs, and improve documentation for the SAM CLI
Want to dive into the docs or watch a SAM tutorial?