Posted On: Jul 21, 2020
The AWS Serverless Application Model Command Line Interface (SAM CLI) is now generally available. SAM CLI is a deployment toolkit that also allows you to locally build, test, and debug serverless applications. SAM CLI v.1.0.0 is a stable version recommended for building production serverless applications.
Previously, SAM CLI was available in beta, supported by the docker-lambda emulation images developed by Michael Hart (AWS Serverless Hero). Now, v1.0.0 is supported by AWS provided emulation images. This version also includes new build support for custom AWS Lambda runtimes and AWS Lambda Layers.
SAM CLI enables you to easily build serverless applications using a number of commands, including sam init, sam build, and sam deploy. Using sam build, you can compile your application code and dependencies. To compile Custom AWS Lambda runtimes and AWS Lambda Layers, you can include the BuildMethod property in your SAM template under the function or layer resource. The BuildMethod is either an AWS Lambda runtime or Makefile, which defines a set of tasks to be executed.
You can use sam build to compile a single layer, a single function resource (compiles both function code and layers) or compile the entire application. SAM CLI also enables you to locally test and debug your application before building it using sam local invoke. You can then deploy your application using sam deploy --guided.
You can use SAM CLI with IDEs like AWS Cloud9 and AWS Toolkits for PyCharm, IntelliJ, and Visual Studio Code. To provide feedback or make pull requests, visit SAM CLI on GitHub. SAM CLI is available in all Regions where AWS Lambda is available. To see all supported Regions, visit the AWS Region Table. To get started, install the AWS SAM CLI.