Exams / SAA-C03 / Decoupling with queues / Question 6
SAA-C03 practice question: Decoupling with queues (6 of 6)
Design Resilient Architectures A free question from our original SAA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.
An Amazon EventBridge rule invokes an AWS Lambda function asynchronously for each new insurance claim. Occasionally the function fails on every attempt and the claim event is lost. The team must keep every failed event for investigation and replay. Investigators need the original event together with the full error the function returned, which often includes a stack trace of 3 to 5 KB. The team does not want to change the function code. What should a solutions architect do?
Choose one answer.
- AA. Configure an Amazon SQS standard queue as the function's dead-letter queue, and read the failed events and error attributes from it.
- BB. Configure an Amazon SQS standard queue as an on-failure destination for the function's asynchronous invocations.
- CC. Set the function's maximum retry attempts to 2 and its maximum event age to 6 hours, so Lambda retries failed events for longer.
- DD. Wrap the handler in a try/catch block that writes the event and stack trace to Amazon CloudWatch Logs before re-raising the error.
Show the answer and explanation
Answer: B
- A. Wrong: A Lambda dead-letter queue does keep failed events, so nothing is lost. However, Lambda sends only the event itself, with the error message as an attribute truncated to the first 1 KB, so a 3-to-5 KB stack trace would be cut off. An on-failure destination includes the full response. Learn more: Capturing records of Lambda asynchronous invocations (opens in a new tab)
- B. Right: Correct. When an asynchronous invocation fails all its attempts, Lambda sends an invocation record to the destination. The record contains the original event as the request payload and the function's error response, so investigators get both and can replay the event from the queue. Learn more: Capturing records of Lambda asynchronous invocations (opens in a new tab)
- C. Wrong: Two retries is already the default and the maximum, and 6 hours is the longest event age Lambda allows, so nothing would change. When retries are used up, Lambda still discards the event unless a dead-letter queue or on-failure destination is set. Learn more: How Lambda handles errors and retries with asynchronous invocation (opens in a new tab)
- D. Wrong: This changes the function code, which the team wants to avoid. It also misses failures that the handler cannot catch, such as timeouts, and replaying events from log lines is a manual job.
Explanation
Lambda discards an asynchronous event once retries are exhausted unless a dead-letter queue or an on-failure destination is configured. Both keep the event, but only the destination's invocation record includes the full function response; a dead-letter queue keeps just the event and the first 1 KB of the error message. An SQS on-failure destination therefore meets the replay and full-error needs with no code changes.
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.