Exams / DVA-C02 / Lambda invocation, errors and destinations / Question 1
DVA-C02 practice question: Lambda invocation, errors and destinations (1 of 2)
Development with AWS Services A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.
Amazon S3 invokes a Lambda function asynchronously for each uploaded file. When the function fails on all of its retries, the team wants a record of the failed event that also includes the error message returned by the function, so they can analyse it later. What should the developer configure?
Choose one answer.
- AA. A dead-letter queue on the function using an Amazon SQS queue.
- BB. A dead-letter queue on the S3 bucket for failed event notifications.
- CC. A longer function timeout and a higher retry count in the event notification.
- DD. An on-failure destination for asynchronous invocation, such as an Amazon SQS queue.
Show the answer and explanation
Answer: D
- A. Wrong: A DLQ receives the event itself, with only a short error message attribute. It does not include the response details.
- B. Wrong: S3 event notifications have no dead-letter queue setting. Retries and failures are handled by Lambda.
- C. Wrong: S3 notifications have no retry count setting, and this records nothing about failures.
- D. Right: Correct. The destination receives an invocation record that includes the request payload and the response, with the error details.
Explanation
For asynchronous invocations, Lambda destinations can capture both successes and failures. A destination record contains the request context, the original event and the response payload, including the function error. A dead-letter queue only keeps the event plus a few attributes, so destinations are better when you need the error details.
Study
Keep practising
Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.