Introduction to testing with the sam local command
Use the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI) sam local
command to test your serverless
applications locally.
For an introduction to the Amazon SAM CLI, see What is the Amazon SAM CLI?.
To use sam local
, install the Amazon SAM CLI by completing the following:
Before using sam local
, we recommend a basic understanding of the following:
Using the sam local command
Use the sam local
command with any of its subcommands to perform different types of local testing for
your application.
$
sam local
<subcommand>
To learn more about each subcommand, see the following:
-
Intro to sam local generate-event – Generate Amazon Web Service events for local testing.
-
Intro to sam local invoke – Initiate a one-time invocation of an Amazon Lambda function locally.
-
Intro to sam local start-api – Run your Lambda functions using a local HTTP server.
-
Intro to sam local start-lambda – Run your Lambda functions using a local HTTP server for use with the Amazon CLI or SDKs.