AWS Serverless Application Model

Build serverless applications in simple and clean syntax

The AWS Serverless Application Model (AWS 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, AWS SAM transforms and expands the SAM syntax into AWS CloudFormation syntax, enabling you to save time and build, test, and deploy serverless applications faster.

AWS SAM is open sourced under the Apache 2.0 license. You can contribute new features and enhancements to AWS SAM on GitHub

To create a serverless application using AWS SAM, create a SAM template: a JSON or YAML configuration file that describes your Lambda functions, API endpoints, and the other resources in your application. You can then test, upload, and deploy your application using SAM CLI.

Install AWS SAM CLI

Download and run the 64-bit or 32-bit Windows installer.

Install using pip. Requires Python 2.6.5 or higher.

The AWS CLI comes pre-installed on Amazon Linux AMI.

Why SAM?

Single Deployment Configuration

AWS SAM makes it easy to organize related components and resources and operate on a single stack. You can use AWS SAM to share configuration, such as memory and timeouts between resources, and deploy all related resources together as a single, versioned entity.

Local Testing and Debugging

The AWS SAM Command Line Interface (CLI) lets you locally build, test, and debug serverless applications defined by AWS SAM templates. The SAM CLI provides a Lambda-like execution environment locally and helps you catch issues upfront by providing parity between the actual Lambda execution environment. Use AWS SAM to step-through and debug your code to understand what the code is doing.

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.

Deep Integration with Development Tools

AWS SAM integrates with a suite of AWS tools for building serverless applications. 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. You can also use AWS CodeStar to start with a project structure, code repository, and CI/CD pipeline configured for you. 

Built-In Best Practices

You can use AWS SAM to define and deploy your infrastructure as config. This allows you to leverage and enforce best practices, such as code reviews. You can also enable safe-deployments through AWS CodeDeploy and tracing using AWS X-Ray with just a few lines of configuration. 

What's New with SAM

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

Aug 30 2018 —  You can now use AWS 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

AWS SAM CLI Simplifies Building with SAM init Command

May 8 2018 — You can use the SAM init command to initialize a ready-to-deploy SAM application in your preferred runtime. The new SAM init command creates an application with sample code, unit tests, and the SAM template itself. Read more

Contribute to AWS SAM

Browse, configure, and deploy open-source applications from the AWS Serverless Application Repository, or publish and share your own. 

Make pull requests, find examples, and read AWS SAM documentation and comments on GitHub.

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

Want to deep dive into documentation or watch AWS SAM tutorials and demos? 

Visit the AWS SAM resources page
Have more questions?
Contact us