
Answer-first summary for fast verification
Answer: By utilizing the AWS SAM CLI to start Lambda locally, generate an S3 event, and invoke the Lambda function with the test JSON.
The correct answer is C. Using the AWS SAM CLI (Serverless Application Model Command Line Interface) allows developers to simulate AWS Lambda environments locally. The steps are as follows: 1) Start the Lambda function locally using the `sam local start-lambda` command. 2) Generate an S3 event using the `sam local generate-event s3 put` command. 3) Invoke the Lambda function locally with the generated JSON file using the `sam local invoke` command. This method has the least operational overhead as it integrates local testing and emulation of the AWS environment efficiently.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can a developer locally test an AWS Lambda function triggered by an S3 object upload with minimal operational overhead?
A
By uploading an object to S3 and awaiting the local Lambda function invocation.
B
By creating a JSON file simulating an S3 event and using the AWS CLI to invoke the Lambda function.
C
By utilizing the AWS SAM CLI to start Lambda locally, generate an S3 event, and invoke the Lambda function with the test JSON.
D
By crafting a JSON string for an S3 event and using the AWS Management Console to test the Lambda function locally.
No comments yet.