nerdexam
Amazon

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 process

The correct answer is B. Increase the visibility timeout of the SQS queue.. When a Lambda function takes longer to process an SQS message than the queue's visibility timeout, SQS makes the message visible again, causing it to be processed twice; increasing the visibility timeout resolves this.

Submitted by yuriko_h· Mar 5, 2026Troubleshooting and Optimization

Question

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?

Options

  • AIncrease the timeout of the Lambda function.
  • BIncrease the visibility timeout of the SQS queue.
  • CIncrease the memory allocation of the Lambda function.
  • DIncrease the batch size in the event source mapping.

How the community answered

(38 responses)
  • A
    13% (5)
  • B
    74% (28)
  • C
    5% (2)
  • D
    8% (3)

Why each option

When a Lambda function takes longer to process an SQS message than the queue's visibility timeout, SQS makes the message visible again, causing it to be processed twice; increasing the visibility timeout resolves this.

AIncrease the timeout of the Lambda function.

Increasing the Lambda function timeout only extends how long Lambda is allowed to run; it does not affect the SQS visibility timeout, so the message can still become visible again before Lambda finishes.

BIncrease the visibility timeout of the SQS queue.Correct

The SQS visibility timeout must be set to at least as long as the Lambda function's maximum processing time; if Lambda has not deleted the message before the visibility timeout expires, SQS assumes the processing failed and makes the message available to consumers again, causing re-processing.

CIncrease the memory allocation of the Lambda function.

Memory allocation affects Lambda execution speed for compute-bound tasks but does not change the SQS visibility timeout or prevent messages from reappearing.

DIncrease the batch size in the event source mapping.

Increasing the batch size causes Lambda to process more messages per invocation but does not change the visibility timeout, so all messages in a batch can still reappear if processing takes longer than the timeout.

Concept tested: SQS visibility timeout alignment with Lambda processing time

Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice