A developer is configuring a serverless application where an AWS Lambda function processes messages from an Amazon SQS queue. The function performs CPU-intensive video transcoding that takes up to minutes to complete per message. During initial testing, the Lambda function's timeout is set to the default of seconds, resulting in execution timeouts. Additionally, the developer needs to prevent messages from being received and processed multiple times by other concurrent Lambda invocations while a message is currently being processed. Which configuration changes will resolve the execution timeouts and prevent duplicate message processing?
- Configure the Lambda function's timeout to seconds, and set the Amazon SQS queue's visibility timeout to at least seconds.Answer
- BConfigure the Lambda function's timeout to seconds, and set the Amazon SQS queue's visibility timeout to seconds.
- CConfigure the Lambda function's timeout to seconds, and set the Amazon SQS queue's visibility timeout to seconds.
- DConfigure the Lambda function's timeout to seconds, and set the Amazon SQS queue's visibility timeout to seconds.
Answer
Configure the Lambda function's timeout to seconds, and set the Amazon SQS queue's visibility timeout to at least seconds.
The correct configuration is to set the Lambda function's timeout to seconds (to accommodate the -minute processing time) and the SQS visibility timeout to at least seconds. According to AWS best practices, the visibility timeout of an SQS queue triggering a Lambda function should be configured to at least times the Lambda function's timeout to prevent message processing loops and duplication due to throttling or retries.
Step-by-Step Solution
Key Concept
AWS Lambda integration with Amazon SQS and visibility timeout configuration guidelines
Estimated Time:2m 0s