Skill 1.2.4

Write and run test code by using AWS services and tools

Key Concepts

Locally, the AWS SAM CLI runs functions in containers with sam local invoke and serves APIs with sam local start-api, using events created by sam local generate-event. In the Lambda console you can save test events, including shareable ones that other developers in the account can use, and invoke the function with them.

For integration testing, deploy the stack to a separate test environment with sam deploy (or sam sync for fast iteration) and invoke it with sam remote invoke, the AWS CLI (aws lambda invoke) or the SDK, checking results in CloudWatch Logs and X-Ray traces.