I was provisioned some AWS keys. These keys give me access to certain directories in a s3 bucket. I want to use boto3
to interact with the directories that were exposed to me, however it seems that I can't actually do anything with the bucket at all, since I don't have access to the entire bucket.
This works for me from my terminal:
aws s3 ls s3://the_bucket/and/this/specific/path/
but if I do:
aws s3 ls s3://the_bucket/
I get:
An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
which also happens when I try to access the directory via boto3
.
session = boto3.Session(profile_name=my_creds)
client=session.client('s3')
list_of_objects = client.list_objects(Bucket='the_bucket', Prefix='and/this/specific/path', Delimiter='/')
Do I need to request access to the entire bucket for boto3
to be usable?
You need to set this Bucket Policy:
For more information about Specifying Permissions in a Policy