Introduction to testing with the sam local command
Use the AWS Serverless Application Model Command Line Interface (AWS SAM CLI) sam local
command to test your serverless
applications locally.
For an introduction to the AWS SAM CLI, see What is the AWS SAM CLI?.
To use sam local
, install the AWS 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 AWS service events for local testing.
-
Intro to sam local invoke – Initiate a one-time invocation of an AWS 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 AWS CLI or SDKs.