
Answer-first summary for fast verification
Answer: Employ AWS SAM CLI to generate events and invoke Lambda functions locally, verify responses, and ensure comprehensive documentation and CI/CD pipeline incorporation.
The correct answer is C. The AWS Serverless Application Model (AWS SAM) CLI tool is specifically designed for building, testing, and debugging serverless applications. The `sam local generate-event` command generates sample events, and the `sam local invoke` command allows you to invoke Lambda functions locally in a Docker container that simulates the Lambda environment. This approach is ideal for local testing and can be smoothly integrated into CI/CD pipelines, ensuring thorough automated testing before deployment.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
A developer seeks to reduce bugs in AWS Lambda functions within a Node.js application by implementing automated testing that simulates the Lambda environment. The solution must enable local testing by developers and integrate into the CI/CD pipeline pre-AWS CDK deployment. Which approach should be adopted?
A
Develop test scripts using documented Lambda events and a specific command for local Lambda function invocation, ensuring response verification and CI/CD pipeline integration.
B
Utilize a unit testing framework mimicking the Lambda environment, create events, invoke the handler function, verify responses, and prepare documentation and CI/CD pipeline updates.
C
Employ AWS SAM CLI to generate events and invoke Lambda functions locally, verify responses, and ensure comprehensive documentation and CI/CD pipeline incorporation.
D
Generate Lambda events, use a Docker container for function invocation, verify responses, and provide complete documentation and CI/CD pipeline integration steps.