Question

Difficulty: EasyDebugging Lambda Execution and Configuration Issues

A backend service uses an AWS Lambda function to process 15 MB15\text{ MB} data files uploaded to Amazon S3. During execution, the function stops processing before completing, and the Amazon CloudWatch logs report that the function reached its configured execution limit of 15 seconds15\text{ seconds}. Which action should the developer take to resolve this issue?

  1. Increase the timeout configuration parameter of the Lambda function.Answer
  2. B
    Modify the function code to clear the execution context cache after every iteration of the file processing loop.
  3. C
    Configure the Lambda function to run inside a public subnet of a custom VPC to establish a direct connection to Amazon S3.
  4. D
    Hardcode temporary AWS access keys within the SDK client initialization to speed up authorization checks.

Answer

Increase the timeout configuration parameter of the Lambda function.
The correct action is to increase the timeout configuration of the Lambda function. When a Lambda function hits its configured execution limit, AWS Lambda terminates the container. If the workload simply requires more time to run (e.g., parsing a larger file), the configuration must be updated to a higher timeout value.

Step-by-Step Solution

1
Analyze the error message from the CloudWatch logs.
The log indicates the function timed out after 15 seconds15\text{ seconds}, which is its currently configured maximum execution limit.
Understanding the failure symptom shows that the execution is aborted by AWS Lambda because the processing time exceeded the timeout configuration.
2
Evaluate the workload requirements.
Processing a 15 MB15\text{ MB} file requires more CPU time and network transfer time than the default 15 seconds15\text{ seconds} configuration allows.
Determining if the code is stuck in an infinite loop or simply needs more time to run is necessary to choose the correct remediation step.
3
Adjust the Lambda function configuration.
Increase the timeout setting (up to the maximum limit of 15 minutes15\text{ minutes}) to accommodate the processing time of larger files.
Modifying the configuration settings allows the function to execute longer without being terminated mid-process.

Key Concept

AWS Lambda execution timeout configuration
Rate this question