Q88 — AWS DVA-C02 Ch.2

Question 88 of 100 | ← Chapter 2

A developer is using an AWS Lambda function to generate thumbnails for personal photos uploaded to an Amazon S3 bucket. The Lambda function is automatically invoked for personal photos stored under the `/original/` S3 prefix. The developer notices that certain photos cause the Lambda function to time out. The developer wishes to implement a fallback mechanism using another Lambda function that resizes photos. Which solution meets these requirements with the least development effort?

Correct Answer: B. Create an Amazon Simple Queue Service (Amazon SQS) queue. Configure the SQS queue as the destination for failed invocations of the thumbnail-generator Lambda function. Configure the image-resizing Lambda function to poll the SQS queue.

Explanation

SQS queue as intermediary: Using an SQS queue decouples photo-resize requests by queuing them. Even if the thumbnail-generator Lambda function times out or fails, requests are not lost. Failure handling: Configuring the thumbnail-generator Lambda function to send failed invocations to the SQS queue ensures messages re-enter the queue for retry, guaranteeing eventual processing of all photo requests. Image-resizing Lambda function: Configuring it to poll the SQS queue enables it to retrieve and process resize requests reliably without data loss or dropped requests. Why other options are inferior: Option A does not directly resolve timeout issues and lacks explicit queuing or failure-recovery mechanisms. Option C introduces unnecessary complexity; Step Functions is overkill for simple queue-based retry logic. Option D uses SNS, which lacks queuing semantics and is unsuitable for reliable failure recovery. Thus, Option B best satisfies the requirements with minimal development effort and robust failure recovery.