A developer is implementing a medical imaging pipeline where scan metadata is published to an Amazon SNS topic. An Amazon SQS queue, which is subscribed to the topic, triggers an AWS Lambda function to generate detailed diagnostic reports. The Lambda function has a timeout of seconds, and a single report can take up to seconds to generate. During testing, the developer observes that several reports are being generated multiple times for the same scan.
Which configuration change should the developer make to resolve this duplicate processing issue?
- Increase the visibility timeout of the SQS queue to at least seconds.Answer
- BSet the visibility timeout of the SQS queue to seconds to match the Lambda function timeout.
- CConfigure an SQS dead-letter queue (DLQ) with a maxReceiveCount of on the main queue.
- DIncrease the Lambda function timeout to seconds while leaving the queue settings at their defaults.
Answer
Increase the visibility timeout of the SQS queue to at least seconds.
The correct answer is to increase the SQS visibility timeout to at least seconds. According to AWS best practices for SQS-Lambda event source mappings, the queue's visibility timeout must be set to at least 6 times the Lambda function's timeout. This buffer allows the Lambda service to handle retries and throttling without immediately making the message visible to other concurrent execution environments.
Step-by-Step Solution
Key Concept
SQS Visibility Timeout configuration with AWS Lambda integration
Estimated Time:1m 30s