AWS Certified Developer – Associate (DVA-C02) — Question 486

A developer is testing an AWS Lambda function that has an event source of an Amazon Simple Queue Service (Amazon SQS) queue. The developer notices that some of the messages the Lambda function processes re-appear in the queue while the messages are being processed.

The developer must correct this behavior.

Which solution will meet this requirement?

Answer options

Correct answer: B

Explanation

If a message reappears in the SQS queue while the Lambda function is still processing it, the SQS visibility timeout is too short compared to the execution time. Increasing the visibility timeout of the SQS queue ensures the message remains invisible to other consumers until the Lambda function completes its execution and deletes the message. Changing the Lambda timeout, memory, or batch size will not prevent this issue if the SQS visibility timeout is not properly aligned.