CertKeen

AWS Developer Associate (DVA-C03) · Free practice question 11 of 12

SQS visibility timeout for Lambda consumers

A Lambda function at Ashcombe Print has a timeout of 2 minutes and processes messages from an SQS queue whose visibility timeout is 30 seconds. Messages are often processed twice. What should the developer change?

  1. A.Enable long polling on the queue so that messages are hidden until the function returns
  2. B.Lower the function timeout to 10 seconds so that it always finishes before the visibility timeout
  3. C.Increase the queue's maximum message size so that messages are not split and delivered twice
  4. D.Raise the visibility timeout to at least six times the function timeout, as AWS recommends
Show answer and explanation

Correct answer: D. Raise the visibility timeout to at least six times the function timeout, as AWS recommends

Why: If a message's visibility timeout expires before the function finishes, the message becomes visible and is delivered again; AWS recommends setting the queue's visibility timeout to at least six times the function timeout for Lambda event source mappings. Cutting the function timeout would make legitimate work fail. Long polling affects how receives wait, not how long messages stay hidden. Message size has nothing to do with duplicate delivery.

More free AWS Developer Associate (DVA-C03) questions