Posted On: Jul 21, 2020
The Amazon 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 (Amazon Web Services Serverless Hero). Now, v1.0.0 is supported by Amazon Web Services provided emulation images. This version also includes new build support for custom Amazon Lambda runtimes and Amazon 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 Amazon Lambda runtimes and Amazon Lambda Layers, you can include the BuildMethod property in your SAM template under the function or layer resource. The BuildMethod is either an Amazon 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 Amazon Web Services 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 Amazon Lambda is available. To see all supported Regions, visit the Amazon Web Services Region Table. To get started, install the Amazon SAM CLI.