Soru

Zorluk: KolayDebugging Lambda Execution and Configuration Issues

A developer deploys a new AWS Lambda function configured with the default timeout of 33 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?

  1. Increase the timeout configuration setting of the Lambda function.Cevap
  2. Add permissions for `logs:CreateLogStream` and `logs:PutLogEvents` to the Lambda function's IAM execution role.Cevap
  3. C
    Configure the Lambda function to run inside a VPC public subnet to allow outbound access to the CloudWatch service endpoints.
  4. D
    Increase the memory allocation of the Lambda function, which automatically raises the timeout threshold proportionally.
  5. E
    Modify the IAM trust policy of the execution role to allow the CloudWatch Logs service principal to assume the role.

Cevap

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.

Adım Adım Çözüm

1
Analyze the timeout symptom and identify that the default limit of 33 seconds is being exceeded, requiring an increase in the function's timeout configuration.
The execution timeout is adjusted to a higher value (e.g., 3030 seconds).
This prevents premature termination during the processing of larger payloads.
2
Analyze the logging symptom and identify that the Lambda function's IAM execution role lacks permissions to write logs to CloudWatch.
The IAM policy associated with the execution role is updated.
Adding permissions for log stream creation and event delivery allows Lambda to output logs to CloudWatch.

Anahtar Kavram

AWS Lambda basic configuration limits and IAM execution role permissions
Bu soruyu puanla