I am trying to access S3 bucket from a SageMaker container in another region.
I am able to list down all the folders in the S3 bucket using the following code:
import boto3
s3 = boto3.resource('s3', region_name='us-east-1')
bucket = s3.Bucket('bucket-name')
for my_bucket_object in bucket.objects.all():
print(my_bucket_object)
However, get_object fails with a message access denied. All permissions have been provided to the S3 bucket.
s3 = boto3.client('s3',region_name = 'us-east-1')
obj = s3.get_object(Bucket='bucket-name', Key = '2019/3/')
Error message is below:
ClientError: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied
Can someone guide on why this is happening? Thank you.
can u copy paste policy file you are using on your bucket. Using policy file you can control all access at folder levels also.
There are a few things you need to check:
s3:GetObject
permission (or s3:*
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.