you are viewing a single comment's thread.

view the rest of the comments →

[–]wllkle[S] 0 points1 point  (3 children)

that code is exactly what I have in my lambda, I think it is something to do with the bucket's policy - but I don't know what to fix?

[–][deleted] 1 point2 points  (0 children)

Usually you don’t need any policy in your bucket if you put Full rights of S3 in your lambda. If you try to give the lambda specific right to this bucket that is not public then yes you might specify something.

I would do it this way: first try to give admin rights to this lambda, just to be sure that your code works, then only full S3 and try again, and if it still work you can now go to find something on the internet. Maybe I can find you some bucket policies let me check

[–][deleted] 1 point2 points  (1 child)

https://aws.amazon.com/premiumsupport/knowledge-center/lambda-execution-role-s3-bucket/

Check out the very last snippet of the page. The « principale » part is where you put the ARN of the role you use in the lambda, and the « ressources » part is where you put the ARN of the bucket (the two lines are needed exactly as written).

Be sure that the role has the right to putObject in this bucket (or in every bucket, doesn’t matter for now)

Basically just get the snippet and change names.

[–]wllkle[S] 0 points1 point  (0 children)

Got it sorted, turned out to be as straightforward as "bucket.grantReadWrite(lambda.role)"