AWS Certified Developer – Associate — Question 442

A company hosts a microservices application that uses Amazon API Gateway. AWS Lambda, Amazon Simple Queue Service (Amazon SQS), and Amazon
DynamoDB. One of the Lambda functions adds messages to an SQS FIFO queue.
When a developer checks the application logs, the developer finds a few duplicated items in a DynamoDB table. The items were inserted by another polling function that processes messages from the queue.
What is the MOST likely cause of this issue?

Answer options

Correct answer: D

Explanation

If the polling Lambda function's execution timeout is longer than the SQS queue's visibility timeout, a message may become visible again in the queue before the processing function can finish and delete it. This leads to another invocation processing the same message, causing duplicate writes to Amazon DynamoDB. To prevent this, the SQS visibility timeout must always be configured to be greater than the Lambda function's timeout.