A Lambda function is triggered from an Amazon SQS queue. During testing, some messages reappear in the queue while they are still being processed by the function. How can you stop the messages from reappearing?
Choose an answer
Tap an option to check your answer.
Correct answer: Increase the SQS queue visibility timeout..
Why this is the answer
The SQS queue visibility timeout determines how long a message is hidden from other consumers after it's been received. If a message reappears in the queue while still being processed, it means the Lambda function hasn't finished processing and deleting the message before the visibility timeout expires. Increasing the visibility timeout gives the Lambda function more time to process the message and delete it from the queue, preventing it from becoming visible again and being processed multiple times. Increasing the Lambda function timeout only affects how long the function can run, not how long the message is hidden in SQS. Increasing memory allocation might speed up processing but doesn't directly address the visibility timeout issue. Increasing batch size could exacerbate the problem if processing takes longer for more messages.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed