Question 1
A developer is building a serverless application that uses an AWS Lambda function to process images uploaded to an Amazon S3 bucket. The function is written in Python and uses the Boto3 library. During testing, the developer notices that the function works correctly for small images but fails with a timeout error for larger images (over 100 MB). The current Lambda configuration has a memory of 128 MB and a timeout of 15 seconds. What is the MOST effective first step to resolve the timeout issue while adhering to the principle of least privilege for resource allocation?
Answer and explanation
Correct answer: B
In AWS Lambda, CPU power is allocated proportionally to the amount of memory configured. Image processing is a CPU-intensive task. By increasing the memory, the developer also increases the available vCPU, which will speed up the processing of larger images and likely resolve the timeout issue. This is more effective than just increasing the timeout, as it addresses the root cause of the slow performance. AWS Lambda Power Tuning is a tool that can help find the optimal memory setting.