AWS SAM CLI Simplifies Building Serverless Apps with the SAM init Command

Posted on: May 8, 2018

The AWS Serverless Application Model (SAM) Command Line Interface (CLI), also referred to as SAM Local, lets you locally build, test, and debug serverless applications defined by AWS SAM templates. Now, 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. It also allows you to initialize SAM applications using a custom structure so you can standardize them across teams and organizations. To learn more about using the SAM init command, visit our documentation

SAM CLI now uses the recently open-sourced SAM implementation, which enables you to leverage any new SAM functionality immediately after release. With this release, the SAM validate command allows you to locally identify any syntax errors before you deploy an application to production. SAM templates that pass the SAM validate command will also pass validation when deployed using AWS CloudFormation.

To get started with SAM CLI, install it using the command: pip install aws-sam-cli. You can also use SAM CLI with IDEs like AWS Cloud9, Visual Studio Code, and Eclipse.

To learn more about building, testing, and deploying serverless applications using SAM CLI, visit our documentation and the code repository on GitHub. 

Modified 12/23/2021 – In an effort to ensure a great experience, expired links in this post have been updated or removed from the original post.