A developer is troubleshooting an AWS Lambda function that processes batch files. The function fails during execution, and the Amazon CloudWatch logs show the message: "Task timed out after seconds". The developer realizes the function requires at least minutes to process the files. Which configuration change will resolve this issue?
- AAssociate the Lambda function with a public subnet in a VPC to bypass execution time limits.
- BAdd an Access-Control-Allow-Origin header to the Lambda function's environment variables.
- Increase the Lambda function timeout setting from the default of seconds to a value greater than minutes.Cevap
- DInitialize the AWS SDK inside the handler by hardcoding permanent IAM credentials to speed up execution.
Cevap
Increase the Lambda function timeout setting from the default of seconds to a value greater than minutes.
The correct answer is to increase the Lambda function timeout setting from the default of seconds to a value greater than minutes. By default, Lambda functions have a -second timeout, which is insufficient for tasks requiring several minutes of processing. Adjusting the timeout configuration in the AWS Management Console, CLI, or infrastructure-as-code template resolves this issue.
Adım Adım Çözüm
Anahtar Kavram
AWS Lambda function timeout configuration and troubleshooting