Question #894
A developer's application uses AWS Lambda to process messages asynchronously. The developer needs to ensure that any messages which fail processing after all retry attempts are stored securely, allowing the application to reprocess them later with minimal operational effort.
Which solution achieves this goal most effectively?
Configure Amazon CloudWatch alarms to detect failures and trigger a Lambda function to archive messages in an Amazon S3 bucket. Use S3 events to reprocess the messages.
Set up an Amazon EventBridge rule to route failed invocations to an Amazon Kinesis Data Stream. Use a Lambda function to consume and reprocess the messages from the stream.
Enable a dead-letter queue on the Lambda function to capture failed messages. Configure the application to poll the queue and resubmit messages for processing.
Use Amazon Simple Notification Service (Amazon SNS) to publish all messages. Subscribe the Lambda function and an Amazon SQS queue to the topic. Configure the application to monitor the queue for failures.
Explanation
Option C is correct because AWS Lambda's built-in dead-letter queue (DLQ) feature automatically captures failed asynchronous invocations after all retry attempts. Configuring the application to poll the DLQ (an Amazon SQS queue) allows seamless reprocessing without additional infrastructure.
Other options are less efficient:
- A adds complexity with CloudWatch alarms and S3 events, requiring manual setup.
- B uses EventBridge and Kinesis, which are not natively integrated with Lambda's retry mechanism.
- D uses SNS but does not directly tie failed messages to reprocessing, risking duplication.
Key Points:
1. Lambda's DLQ (SQS/SNS) is designed for failed async invocations.
2. Minimal operational effort is achieved by leveraging native AWS features.
3. Alternatives introduce unnecessary services and complexity.
Answer
The correct answer is: C