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?
- A.Enable long polling on the queue so that messages are hidden until the function returns
- B.Lower the function timeout to 10 seconds so that it always finishes before the visibility timeout
- C.Increase the queue's maximum message size so that messages are not split and delivered twice
- 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
- Step Functions Retry and Catch fields
- SQS FIFO message groups for ordering
- DynamoDB Streams for change processing
- EventBridge Scheduler one-time invocations
- Explicit deny in policy evaluation
- Hardening S3 bucket access settings
- ApplyGuardrail API for any model
- Previewing stack updates with change sets
- Test traffic hook in ECS blue/green
- API Gateway REST canary release
- Metric filters for log-based alarms