A developer is implementing a food delivery platform where courier dispatch updates are processed using an Amazon SQS standard queue. An AWS Lambda function is configured to consume messages from the queue with a batch size of messages and a function timeout of seconds. During peak loads, some courier assignments are processed multiple times by different Lambda execution environments, even though the Lambda function executes successfully and returns within seconds. Which of the following configuration changes will resolve this issue?
- Increase the SQS queue's visibility timeout to at least seconds.Cevap
- BIncrease the Lambda function's timeout to seconds while keeping the SQS visibility timeout at seconds.
- CDecrease the SQS queue's visibility timeout to seconds to allow faster reprocessing of messages.
- DConfigure the AWS SDK client inside the Lambda function using hardcoded, long-term IAM access keys.
Cevap
Increase the Amazon SQS queue's visibility timeout to at least seconds.
The correct answer is to increase the SQS queue's visibility timeout to at least seconds. AWS recommends setting the visibility timeout of a source SQS queue to at least times the timeout of the consuming Lambda function. With a -second Lambda timeout, the SQS visibility timeout must be set to at least seconds () to allow sufficient time for processing and retries without messages becoming visible to other instances.
Adım Adım Çözüm
Anahtar Kavram
Amazon SQS Visibility Timeout for Lambda Event Sources