Soru

Zorluk: KolayDebugging Lambda Execution and Configuration Issues

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 3.003.00 seconds". The developer realizes the function requires at least 44 minutes to process the files. Which configuration change will resolve this issue?

  1. A
    Associate the Lambda function with a public subnet in a VPC to bypass execution time limits.
  2. B
    Add an Access-Control-Allow-Origin header to the Lambda function's environment variables.
  3. Increase the Lambda function timeout setting from the default of 33 seconds to a value greater than 44 minutes.Cevap
  4. D
    Initialize 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 33 seconds to a value greater than 44 minutes.
The correct answer is to increase the Lambda function timeout setting from the default of 33 seconds to a value greater than 44 minutes. By default, Lambda functions have a 33-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

1
Analyze the error message from CloudWatch logs.
The message indicates a timeout after 3.003.00 seconds, which is the default timeout limit for Lambda functions.
Understanding the error symptom is the first step in identifying the root cause.
2
Compare the required execution time with the configured limit.
The function needs at least 44 minutes, but it is currently limited to 33 seconds.
This establishes that the timeout limit must be raised to cover the required execution window.
3
Modify the Lambda function's configuration.
Change the timeout configuration to a value greater than 44 minutes (e.g., 55 minutes or 300300 seconds).
Adjusting the timeout configuration allows the function to execute to completion.

Anahtar Kavram

AWS Lambda function timeout configuration and troubleshooting
Bu soruyu puanla