I have lambda function (in python) to read file from s3 bucket. When I’m running test case I’m getting error, but I get result from
print("CONTENT TYPE: " + response[‘ContentType’])
(aws test function).
I’ve also tried to run IAM Policy Simulator on lambda function execution role and GetObject - it has access.
I have policy on the bucket (allow all to the function), no KMS key
Will be grateful for any ideas.
Is that GetObject permission on just the bucket or on bucket-name:/*?
Edit: I probably don’t have the right syntax but the wildcard is what I’m trying to convey
If the S3 bucket is encrypted, then the lamda function will also need access to the encryption key in KMS.
On both (I added wildcard a few tries before creating this question)
I have similar function on the other buckey - and it works correctly, and I cannot find any differences in the permission
Access denied can also occur in scenarios where the S3 object is kms encrypted and the lambda IAM role does not have permission on the KMS key
no KMS key
I guess you mean no customer KMS key, but S3 will still use the default aws/s3 key for your account
How are you allowing your lambda bucket access to your s3 bucket . Through s3 bucket policy or IAM policy? Additionally the object your using to test with , who uploaded it ? Could also be ownership issue .
UPDATE: so I still don’t know what the issue is.
IAM policy simulator says it fine and it appeared that I can download the file with the function (but not open it) so I proceed with the downloading and working locally (files are small anyways)
Thank you for all the suggestions