DVA-C02 Question 242
Single answerA developer is working on an application that processes images uploaded to an Amazon S3 bucket. The application uses an AWS Lambda function to resize the images and store the resized versions in another S3 bucket. The developer notices that the Lambda function is failing intermittently. Upon investigation, they discover that the function is exceeding the default execution time limit. How can the developer resolve this issue?
- A
Increase the timeout setting for the Lambda function.
- B
Use Amazon S3 Event Notifications to trigger the Lambda function more frequently.
- C
Break the image processing logic into smaller Lambda functions and use AWS Step Functions to orchestrate them.
- D
Enable AWS Lambda Reserved Concurrency to ensure the function has dedicated execution capacity.
Show answer and explanation
Correct answer: A
Explanation
The issue is that the Lambda function is exceeding the default execution time limit. The simplest and most immediate solution is to increase the timeout setting for the Lambda function, which can be done via the AWS Management Console, CLI, or SDKs. While other options like breaking the logic into smaller functions or ensuring concurrency are valid architectural considerations, they are not directly relevant to resolving the timeout issue in this scenario.
- A. Correct.
Correct. Increasing the timeout setting for the Lambda function is the simplest solution to allow the function more time to complete its execution.
- B. Incorrect.
Incorrect. While S3 Event Notifications can be used to trigger the Lambda function, they do not address the issue of the function exceeding its execution time limit.
- C. Incorrect.
Incorrect. Breaking the image processing logic into smaller Lambda functions and orchestrating them with Step Functions is a valid architectural pattern, but it is a more complex solution that is unnecessary in this scenario.
- D. Incorrect.
Incorrect. Enabling Reserved Concurrency ensures that the Lambda function always has capacity to run, but it does not address the issue of exceeding the execution time limit.