Introducing AWS SAM Local, a CLI Tool to Test AWS Lambda Functions Locally

Posted on: Aug 11, 2017

AWS SAM Local is a CLI tool that allows you to locally test and debug your AWS Lambda functions defined by AWS Serverless Application Model (SAM) templates. Today, SAM Local supports Lambda functions written in Node.js, Java, and Python. SAM Local is available today in beta.  

Previously, you were limited to the AWS Toolkits for Eclipse and Visual Studio if you wanted to perform local testing for your Lambda functions. Now, you can use SAM Local with the IDE of your choice to locally test and debug your AWS SAM-defined Lambda functions. The SAM Local Event Payload Generator enables you to simulate event triggers for your Lambda functions. SAM Local also lets you make local API calls to invoke functions that are fronted by Amazon API Gateway. After SAM Local executes your Lambda functions, you can view the responses and logs on your local machine. SAM Local leverages the docker-lambda Docker images to run your code in a sandbox that simulates the Lambda execution environment.

SAM Local is open sourced under the Apache License 2.0. You can use it with AWS Lambda in all regions where Lambda is available. This includes US East (N. Virginia), US East (Ohio), US West (N. California), US West (Oregon), AWS GovCloud (US), Canada (Central), South America (São Paulo), EU (Frankfurt), EU (Ireland), EU (London), Asia Pacific (Mumbai), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney), and Asia Pacific (Tokyo). To learn more about SAM Local, visit our documentation and the code repository on GitHub. Read our blog for a step-by-step guide on how to use SAM Local.