AWS Serverless Application Model (AWS SAM) is a framework a developer can use to create and deploy serverless applications that run on Amazon's cloud.
How AWS SAM works
AWS SAM is open source and includes two primary components: a template specification and a command-line interface (CLI). The templates are an extension of Amazon's CloudFormation templates, designed specifically for serverless applications. A developer can use a SAM template to define commonly used resources for a serverless app, such as application programming interfaces (APIs), functions and database tables, as a single stack, rather than manually deploy and manage them separately.Content Continues Below
Then, a development team can use the CLI to build and package an application according to those parameters. A developer can also use the SAM CLI to invoke AWS Lambda functions and test and debug applications deployed to the AWS cloud.
Some SAM CLI commands are equivalent to CloudFormation commands, such as sam package in SAM and aws cloudformation package in CloudFormation. However, the SAM CLI has some unique features, including template validation and local testing.
AWS SAM features
AWS SAM integrates with a collection of native Amazon cloud services, including Cloud9 IDE, AWS CodeBuild, AWS CodeDeploy and AWS CodePipeline. These tools work in conjunction with SAM and CloudFormation to build and run Lambda functions in AWS.
In addition, SAM enables a developer to share configurations between resources ahead of deployment, as a single, versioned entity.
A developer can use the AWS SAM Local feature to build and test Lambda functions in an offline environment. This can expedite testing, as code changes can take several minutes on AWS.
With SAM Local, a command runs a Docker container and simulates an API Gateway and Lambda environment in a developer's local system. The developer can then identify any potential code issues and fix them locally before the serverless application is updated on the AWS cloud.