Configuring AWS Lambda to access S3 Bucket

Question:

I just can’t figure out what is wrong with my Bucket Policy in AWS. Trying to let a Lambda function to access and read an email from the S3 Bucket. But I keep getting “Access Denied”

Please note that I notice the email file is being created in the bucket. Here is my last version of the Bucket Policy:

I have tried also with “Principal”: {“Service”: “ses.amazonaws.com”}, alas

I keep getting Access Denied:

And here is my Lambda function:

After long time and many versions of the Bucket Policy I am thinking of trying another solution and drop AWS.

Any ideas ?

Answer:

You need to create an IAM role and attach it to the Lambda function with S3FullAccess policy or with finegrained permission for the specific bucket and actions (Recommended).

Also make sure trust relationship configuration is added to the role.

Note: In your current setup, it seems like you have configured the bucket policy which grants read access to the root user.

Leave a Reply