S3:无效的存储桶名称 - 存储桶名称必须与正则表达式匹配

S3: Invalid bucket name - Bucket name must match the regex

我尝试使用以下代码列出一个特定 S3 存储桶中的对象:

conn = client('s3')  # again assumes boto.cfg setup, assume AWS S3
for key in conn.list_objects(Bucket='arn:aws:s3:::my-bucket1/NAME/OF/FOLDER/')['Contents']:
    print(key['Key'])

但是得到这个错误:

Invalid bucket name "arn:aws:s3:::my-bucket1/NAME/OF/FOLDER/": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" or be an ARN matching the regex "^arn:(aws).*:(s3|s3-object-lambda):[a-z\-0-9]*:[0-9]{12}:accesspoint[/:][a-zA-Z0-9\-.]{1,63}$|^arn:(aws).*:s3-outposts:[a-z\-0-9]+:[0-9]{12}:outpost[/:][a-zA-Z0-9\-]{1,63}[/:]accesspoint[/:][a-zA-Z0-9\-]{1,63}$"

我也尝试了一些其他方法(指定 S3 存储桶的路径)但没有任何效果。我能做什么?

应该是

Bucket='my-bucket1'
for key in conn.list_objects(Bucket='my-bucket1', Prefix='NAME/OF/FOLDER/')['Contents']:
    print(key['Key'])