简体   繁体   中英

ClientError: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied

I am working with python in a jupyter notebook. I am trying to access several parquet files from an aws s3 bucket and convert them all into one json file. I know I have access to the data, but I am getting:

ClientError: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied

Here is the code I have:

import boto3

s3_resource = boto3.resource('s3')

s3_client = boto3.client('s3')
bucket = s3_resource.Bucket(name='my-bucket')

all_objects = s3_client.list_objects(Bucket = 'my-bucket', Prefix = 'Files.parquet')

I am not sure where the access denied is coming from. Thank you so much!

You can follow this link , and attach the following policy to the user/role.

{
   "Version":"2012-10-17",
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "s3:ListBucket"
         ],
         "Resource":"arn:aws:s3:::my-bucket"
      }
   ]
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM