
Answer-first summary for fast verification
Answer: Use the AWS request ID from the context object and log to standard output.
The correct answer is A: Use the AWS request ID from the context object and log to standard output. When a Lambda function is invoked, the context object includes an AWS request ID, which can uniquely identify each function invocation. Logging to standard output is the recommended approach as it automatically sends logs to Amazon CloudWatch for monitoring and troubleshooting. Writing logs to standard output is simpler and more efficient than writing to a file, which requires additional management of file storage and concurrency issues.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
In AWS Lambda, how should a developer implement logging to include a unique identifier for each function invocation event?
A
Use the AWS request ID from the context object and log to standard output.
B
Use the AWS request ID from the event object and log to a file.
C
Use the AWS request ID from the event object and log to standard output.
D
Use the AWS request ID from the context object and log to a file.
No comments yet.