How to Resolve Duplicate SQS Message Processing in Lambda Cost-Effectively?
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?
Community Votes
73% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
This question tests the understanding of SQS standard queue at-least-once delivery semantics and how FIFO queues with deduplication IDs provide exactly-once processing without architectural changes.
When an AWS Lambda function processes Amazon SQS standard queue messages multiple times, switching to an SQS FIFO queue with a message deduplication ID is the most cost-effective solution. Community consensus strongly favors Option A because FIFO queues natively prevent duplicate delivery.
Many candidates choose Option C (setting Lambda concurrency to 1) because they confuse the duplicate processing issue with a visibility timeout problem caused by high concurrency. While limiting concurrency may reduce duplicates, it does not eliminate them and severely impacts throughput.
Community Discussion (7 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Understanding the Problem
Amazon SQS standard queues provide at-least-once delivery, meaning duplicate messages can occasionally be delivered due to the highly distributed nature of the system. When a Lambda function is triggered by an SQS standard queue, it may receive and process the same message more than once.
Why Option A is Correct
Option A — changing to an SQS FIFO queue with a message deduplication ID — is the most cost-effective and architecturally sound solution. FIFO queues guarantee exactly-once processing by using the MessageDeduplicationId to filter out duplicate messages within a 5-minute deduplication window. This requires no changes to the Lambda function logic and eliminates duplicates at the queue level.
Why Other Options Are Wrong
- Option B (Dead-letter queue): A DLQ only captures messages that fail processing after a set number of retries. It does not prevent duplicate processing of successfully handled messages.
- Option C (Maximum concurrency of 1): While reducing concurrency may lower the chance of overlapping visibility timeouts, it does not solve the fundamental at-least-once delivery nature of standard queues. It also drastically reduces throughput and is not a reliable fix.
- Option D (Amazon Kinesis Data Streams): Migrating to Kinesis introduces significant architectural complexity and cost. It is not a cost-effective solution for a simple deduplication problem.
Community Insight
The majority of the community (73%) agrees with Option A, noting that FIFO queues are purpose-built for deduplication. The 27% who chose Option C often misattribute the duplicates to visibility timeout issues caused by concurrency, but this does not address the root cause in standard queues.
Official Reference
Exam Strategy
When an AWS exam question emphasizes 'most cost-effectively,' look for the simplest native service feature that solves the problem. Avoid answers that require major architectural rewrites (like switching to Kinesis) or that only partially mitigate the issue (like limiting concurrency).
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →