A developer deploys a new AWS Lambda function configured with the default timeout of seconds to process image uploads. During testing with larger image files, the function execution fails and logs a task timeout error. Additionally, the developer notices that no log groups or log streams are being created in Amazon CloudWatch Logs for this function. Which two configuration changes should the developer make to resolve these issues?
- Increase the timeout configuration setting of the Lambda function.Answer
- Add permissions for `logs:CreateLogStream` and `logs:PutLogEvents` to the Lambda function's IAM execution role.Answer
- CConfigure the Lambda function to run inside a VPC public subnet to allow outbound access to the CloudWatch service endpoints.
- DIncrease the memory allocation of the Lambda function, which automatically raises the timeout threshold proportionally.
- EModify the IAM trust policy of the execution role to allow the CloudWatch Logs service principal to assume the role.
Answer
To resolve these issues, the developer must increase the Lambda function's timeout setting and grant the execution role permission to write to CloudWatch Logs.
To resolve the execution failures, the developer must increase the function's timeout setting. To resolve the logging failures, the developer must add permission for log operations (specifically `logs:CreateLogStream` and `logs:PutLogEvents`) to the Lambda function's IAM execution role.
Step-by-Step Solution
Key Concept
AWS Lambda basic configuration limits and IAM execution role permissions