2

I'm trying to resize images automatically using Amazon S3/Lambda. The problem is I cannot get any connection to Amazon S3 buckets while creating a Lambda function.

  1. Creating a new blank function in AWS Lambda
  2. Using Python 3.8
  3. Setting permissions to "use an exsisting role" -> S3accessrole

I checked the policies and permission for the S3 accessrole in the IAM manager console. I also added AMAZON S3FULLACCESS to the S3accessrole. So this role should have access to all S3 buckets in my account.

But when creating the function, no connection is being made to any S3 bucket. Also, Amazon Cloudwatch logs are in the same role also does not appear in the design pane. For example, see this YT video: https://youtu.be/EyeduLX17Mc?t=120

@ the 2min mark you can see the function has access to CloudWatch Logs and Amazon S3. This appears automatically when creating the function. Although this user used another role for this. My Design page only shows the Orange function and has not have access to S3. When adding a new trigger for S3 there also appears a warning message that no other S3 bucket is being used and this can cause problems.

So my question is, what am I missing? The fuction has the correct role which has access to all S3 buckets in my account. And there are no restrictions in my S3 buckets permission wise.

1
  1. Make sure you've got lambda.amazonaws.com in the role's Trusted relationships, otherwise your Lambda can't assume it.
  2. Check out the Lambda's CloudWatch Logs and see what error it gets.
  3. Search the CloudTrail for the lambda events and see what role it's using and you gain any insight there. Note that there may be up to 10 mins lag between the lambda invocation and the logs landing in CloudTrail.
  4. If it's a VPC-Lambda make sure it can actually reach the S3 endpoint. If it's only for resizing images in S3 you may not need VPC config in your lambda at all.

Hope that helps :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.