DVA-C02 · Question #282
A developer is creating an AWS Lambda function that consumes messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The developer notices that the Lambda function processes some…
The correct answer is A. Change the Amazon SQS standard queue to an Amazon SQS FIFO queue by using the Amazon. SQS FIFO queues provide exactly-once processing and content-based deduplication, preventing Lambda from processing the same message more than once.
Question
A developer is creating an AWS Lambda function that consumes messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The developer notices that the Lambda function processes some messages multiple times. How should developer resolve this issue MOST cost-effectively?
Options
- AChange the Amazon SQS standard queue to an Amazon SQS FIFO queue by using the Amazon
- BSet up a dead-letter queue.
- CSet the maximum concurrency limit of the AWS Lambda function to 1.
- DChange the message processing to use Amazon Kinesis Data Streams instead of Amazon SQS.
How the community answered
(27 responses)- A78% (21)
- B7% (2)
- C4% (1)
- D11% (3)
Why each option
SQS FIFO queues provide exactly-once processing and content-based deduplication, preventing Lambda from processing the same message more than once.
SQS standard queues use at-least-once delivery semantics, which means duplicate deliveries are by design. Converting to an SQS FIFO queue enables exactly-once processing through message deduplication IDs, directly eliminating duplicate processing by the Lambda function at the most cost-effective level without adding extra infrastructure.
A dead-letter queue captures messages that fail processing repeatedly but does not prevent duplicate delivery of messages that are successfully processed; it does not address the root cause of duplicates from at-least-once delivery.
Setting maximum concurrency to 1 prevents parallel execution but does not stop the SQS standard queue from redelivering a message that was already successfully processed, so duplicates can still occur.
Migrating to Kinesis Data Streams is a significant architectural change with additional cost and operational complexity, and it is not required when an SQS FIFO queue directly solves the deduplication problem.
Concept tested: SQS FIFO exactly-once processing to prevent duplicate Lambda invocations
Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
Community Discussion
No community discussion yet for this question.