Posted On: Aug 30, 2018

The AWS Serverless Application Model (SAM) Command Line Interface (CLI) lets you locally build, test, and debug serverless applications defined by AWS SAM templates. You can now use 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.

The latest release of SAM CLI integrates with Delve, a debugger for the Go programming language, allowing you to find issues faster by running your function in debugging mode locally. To execute your Lambda function locally in debug mode, use the sam local invoke command with the -d option.

With the update to the sam local generate-event command, you can now generate and customize sample payloads from 50+ events, including those from Amazon CloudFront, AWS CloudFormation, AWS Step Functions, and Amazon Alexa, in addition to Amazon S3, Amazon Kinesis Streams, Amazon DynamoDB, Amazon CloudWatch Scheduled Events, Amazon API Gateway, and Amazon SNS. You can also generate multiple types of events from each service. For example, in addition to generating the event from S3 when a new object is created, you can also generate the event from S3 when an object is deleted. This allows you to simulate events for rapid testing and debugging.

To get started with SAM CLI, install it using the command: pip install aws-sam-cli. You can also use SAM CLI with IDEs such as 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. To further contribute to SAM development, join the active SAM community on Slack.