AWS Certified Developer – Associate — Question 34

A developer is writing an AWS Lambda function. The developer wants to log key events that occur during the Lambda function and include a unique identifier to associate the events with a specific function invocation.
Which of the following will help the developer accomplish this objective?

Answer options

Correct answer: A

Explanation

The correct answer is A because the request identifier can be obtained from the Lambda context object, which provides information about the invocation context. The other options are incorrect because they either suggest using the wrong object (the event object instead of the context object) or recommend logging to a file, which does not align with the requirement to log to the console.