AWS Certified Solutions Architect - Professional / Question #708 of 529

Question #708

A solutions architect is designing a system to process messages that must automatically scale based on workload and redirect failed messages to a dead-letter queue after three processing attempts. Which solution meets these requirements?

A

Send messages to an Amazon SNS topic. Configure an AWS Lambda function as a subscriber. Set the Lambda function's on-failure destination to an Amazon SQS queue with a retry policy of two attempts.

B

Use an Amazon SQS queue to receive messages. Configure an AWS Lambda function with the queue as an event source. Set the queue's redrive policy to a max receive count of 3 and specify a dead-letter queue.

C

Write messages to an Amazon Kinesis Data Stream. Configure an AWS Lambda function to process records. Set the event source mapping's retry attempts to 3 and specify a dead-letter queue.

D

Publish messages to an Amazon EventBridge event bus. Configure an AWS Lambda function as a target with a retry policy of three attempts. Route failed events to an Amazon SQS queue.

Explanation

The correct answer is B because:
- Amazon SQS with Lambda as the event source allows Lambda to automatically scale based on the queue depth, satisfying the auto-scaling requirement.
- SQS's redrive policy is configured with a maxReceiveCount of 3, meaning a message is retried twice (total 3 attempts) before being moved to the dead-letter queue (DLQ).

Other options fail because:
- A: SNS does not manage retries; Lambda's on-failure destination sends messages to DLQ after two retries (3 total attempts), but SNS is less suited for ordered message processing compared to SQS.
- C: Kinesis Data Streams require manual shard management, making auto-scaling less seamless. While Lambda can retry and route to DLQ, SQS-Lambda is more straightforward for this use case.
- D: EventBridge's retry policy counts retries (e.g., 3 retries = 4 total attempts), exceeding the required three attempts. EventBridge is better for event routing than message processing systems.

Key Points: Use SQS with Lambda for scalable message processing. Configure SQS redrive policy (maxReceiveCount) to handle DLQ routing after failed attempts.

Answer

The correct answer is: B