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. You can also use the SAM CLI to deploy your applications to AWS.

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

Mac or Linux

Install SAM CLI using Brew

brew tap aws/tap
brew install aws-sam-cli

Requires Docker and the AWS CLI. See installation instructions

Install SAM CLI using an MSI

Requires Docker and the AWS CLI. See installation instructions

pip install --user aws-sam-cli

Requires Docker and the AWS CLI. See installation instructions

Why SAM?

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.

What's New with SAM

AWS SAM Supports Amazon API Gateway Authorizers

Oct 26 2018 — You can use a single property setting in AWS SAM to define Amazon API Gateway Authorizers and control who can access your Amazon API Gateway APIs using an Amazon Cognito User Pool or an API Gateway Lambda Authorizer. Read more

AWS SAM CLI Supports Debugging Go Functions and Testing with 50+ Events

Aug 30 2018 —  You can now use SAM CLI to debug Lambda functions written in Go in addition to those written in Java, Python, and Node.js. You can also use the sam local generate-event command to generate sample event payloads for 50+ events. Read more

New AWS SAM CLI Commands Simplify Testing and Debugging Serverless Apps

Jul 19 2018 —  You can use the sam logs command to fetch, tail, and filter logs generated by your AWS Lambda functions. You can also use the sam local start-lambda command to invoke local Lambda functions from your automated tests. Read more

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

Ask questions, give answers, and contribute to the development of AWS SAM on Slack 

Want to dive into the docs or watch a SAM tutorial? 

Visit the SAM resources page
Have more questions?
Contact us