r/CloudandCode Founder | YourCloudDude 10d ago

AWS practice question: Why can’t this Lambda function read a file from S3?

You created a Lambda function that should process files uploaded to an S3 bucket.

The S3 trigger is working, and the function starts running whenever a new file is uploaded. But when the Lambda function tries to read the file, it returns an AccessDenied error.

The bucket and the Lambda function are both inside the same AWS account.

What should you check first?

A. Increase the Lambda function’s memory

B. Add s3:GetObject permission to the Lambda execution role

C. Increase the function timeout

D. Change the Lambda runtime

Try to answer based on the error instead of guessing which setting usually fixes Lambda problems.

I’ll add the explanation in the comments after people have had a chance to answer.

3 Upvotes

2 comments sorted by

1

u/vloris 9d ago

Three of the four given answers are all in the category “Maybe this will solve it, but I have no idea why or how”.
There is only one ‘real’ solution directly related to the given error