- Newest
- Most votes
- Most comments
Something that will help you get more information is adding ListBucket permission to your function's IAM Role. I see you're trying to trap s3.exceptions.NoSuchKey but without ListBucket permission you'll never get this. Instead, if your object_key is wrong then you'll get "access denied".
Note that ListBucket applies to the bucket, not objects, so should be allowed for the "example_bucketname" resource, whereas GetObject & PutObject should be allowed for "example_bucketname/*".
If you're still having trouble please post your IAM policy here.
The IAM Policy Simulator can be utilized to verify that your service roles possess the required permissions to execute the desired action.
If the simulator encounters a failure when applying the service role to the resources, it indicates that your policy is improperly configured and requires correction.
Hello.
Are the S3 bucket name and object key correct?
Did you set the IAM policy for the correct IAM role?
You can check the Lambda IAM role as shown in the image below.
Also, since you are accessing with IAM, there is no need to uncheck "Block all public access".
Relevant content
- asked a year ago
- asked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 3 years ago
This worked! Thanks!