【发布时间】:2020-07-16 17:33:28
【问题描述】:
我在 jupyter notebook 中使用 python。 我正在尝试从 aws s3 存储桶访问多个镶木地板文件并将它们全部转换为一个 json 文件。我知道我可以访问数据,但我得到了:
ClientError: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
这是我的代码:
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')
我不确定拒绝访问的来源。非常感谢!
【问题讨论】:
-
您需要将
s3:ListBucket权限授予IAM 用户/角色。 -
谢谢!我在前面的代码块中调用了上面的“for obj in bucket.objects.all():”,这是否意味着我可以访问 ListBucket?
标签: python amazon-s3 jupyter-notebook parquet