Question #867
A developer is building a serverless image processing application using AWS Lambda functions invoked asynchronously. The developer observes that some image processing events fail intermittently. The developer needs to ensure that all failed events are captured for later analysis without losing any events.
Which solution will meet these requirements?
Create an Amazon EventBridge rule that triggers on Lambda failures and sends the events to an Amazon S3 bucket for storage.
Configure the Lambda function with a dead-letter queue using Amazon Kinesis Data Streams. Grant the Lambda execution role permissions to write to Kinesis.
Set up an Amazon Simple Queue Service (SQS) dead-letter queue for the Lambda function. Update the Lambda's execution role to allow sending messages to the SQS queue.
Implement an Amazon SQS FIFO dead-letter queue for the Lambda function. Modify the Lambda execution role to include permissions for the FIFO queue.
Explanation
Answer C is correct because AWS Lambda allows configuring an SQS dead-letter queue (DLQ) for asynchronous invocations. After Lambda's retry attempts, failed events are sent to the DLQ, ensuring no loss of events. The Lambda execution role must be granted permissions (e.g., sqs:SendMessage) to write to the SQS queue.
Why other options are incorrect:
- A: EventBridge can capture Lambda invocation events, but it does not guarantee capturing all failed events after retries, making it less reliable than a DLQ.
- B: Kinesis Data Streams is not a supported DLQ type for Lambda; DLQs must use SQS or SNS.
- D: FIFO queues are unnecessary here as the requirement does not involve message ordering, and standard SQS suffices.
Key Points:
1. Asynchronous Lambda retries failed events twice by default.
2. DLQs (SQS/SNS) capture events after all retries fail.
3. Lambda execution roles require explicit permissions to interact with DLQs.
Answer
The correct answer is: C