AWS Certified Developer – Associate (DVA-C02) — Question 417
A developer is building a microservice that uses AWS Lambda to process messages from an Amazon Simple Queue Service (Amazon SQS) standard queue. The Lambda function calls external APIs to enrich the SQS message data before loading the data into an Amazon Redshift data warehouse. The SQS queue must handle a maximum of 1,000 messages per second.
During initial testing, the Lambda function repeatedly inserted duplicate data into the Amazon Redshift table. The duplicate data led to a problem with data analysis. All duplicate messages were submitted to the queue within 1 minute of each other.
How should the developer resolve this issue?
Answer options
- A. Create an SQS FIFO queue. Enable message deduplication on the SQS FIFO queue.
- B. Reduce the maximum Lambda concurrency that the SQS queue can invoke.
- C. Use Lambda's temporary storage to keep track of processed message identifiers
- D. Configure a message group ID for every sent message. Enable message deduplication on the SQS standard queue.
Correct answer: A
Explanation
Amazon SQS standard queues offer at-least-once delivery, which can occasionally result in duplicate messages being delivered to the AWS Lambda function. Converting the queue to an SQS FIFO queue resolves this because FIFO queues guarantee exactly-once processing and support automatic deduplication within a 5-minute window. Additionally, SQS FIFO queues easily support the required throughput of 1,000 messages per second, especially when using batching or high-throughput mode.