Simulating Lambda Locally

In this lesson, you will learn how to run the application locally using Docker.

Local Lambda runtime environments

Deploying a new version of a Lambda function takes only a minute or two, which is amazing when you consider how many things need to be created in the background, but this is still too slow for a smooth development flow. Together with Docker, SAM can also simulate the Lambda runtime environment locally, so you can experiment and debug code much faster than when deploying to AWS.

Run the following command from your project directory (code/app), which contains the application template (template.yaml):

sam local start-api --host=0.0.0.0

If you use your local machine to run code, you can simply run the following command:

sam local start-api

After you press the Run button, you can click on the URL next to Your app can be found at: to view the application.

Get hands-on with 1400+ tech skills courses.