Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Boto3列出具有访问点的S3 bucket对象_Python_Amazon S3_Boto3_Aws Glue_Amazon S3 Access Points - Fatal编程技术网

Python 使用Boto3列出具有访问点的S3 bucket对象

Python 使用Boto3列出具有访问点的S3 bucket对象,python,amazon-s3,boto3,aws-glue,amazon-s3-access-points,Python,Amazon S3,Boto3,Aws Glue,Amazon S3 Access Points,我正在尝试使用python3boto3s3api客户端的list\uobjects\uv2函数来列出来自S3访问点的对象 示例代码: import boto3 import botocore access_point_arn = "arn:aws:s3:region:account-id:accesspoint/resource" client = boto3.client('s3') response = client.list_objects_v2(Bucket=acc

我正在尝试使用python3boto3s3api客户端的
list\uobjects\uv2
函数来列出来自S3访问点的对象

示例代码:

import boto3
import botocore

access_point_arn = "arn:aws:s3:region:account-id:accesspoint/resource"
client = boto3.client('s3')
response = client.list_objects_v2(Bucket=access_point_arn)
以某种方式获得以下错误:

botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid bucket name "arn:aws:s3:region:account-id:accesspoint/resource": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$"
根据文档:,我应该能够将一个访问点作为Bucket名称传递给
list\u objects\u v2
函数。奇怪的是,这个功能在我的Windows10笔记本电脑上本地运行。相同的Python3.6代码和相同的Boto3和Botocore包版本会在AWS Glue Python Shell作业中引发此错误。我还确保Glue角色具有S3完全访问权限,并附加了Glue服务策略


如果有人能对此有所了解,我将不胜感激。

在Glue上运行代码时,请不要在代码中指定访问点。访问点相对较新。我想知道Glue是否使用了不支持它们的较旧版本的boto?@JohnRotenstein我已经将boto3和botocore滚轮文件作为Glue Python类文件导入,因此请确保它们与我的本地版本一致。@Asdfg不太符合。您的意思是不为
list\u objects\u v2
函数指定Bucket kwarg吗?只需指定不带访问点的Bucket名称即可。比如Bucket=“MyAwesomeBucket”