无法使用 python boto3 模块连接到 nexrad aws s3 存储桶

编码器

我正在尝试使用 python boto3 连接到 Nexrad aws 存储桶,我遇到以下问题:
1) 代码:

import boto3
s3 = boto3.resource('s3')

my_bucket = s3.Bucket('arn:aws:s3:::unidata-nexrad-level2-chunks')

for objects in my_bucket.objects.all():
    print(objects)

Output:
---------------------------------------------------------------------------
ParamValidationError                      Traceback (most recent call last)
<ipython-input-11-0d42db5d6462> in <module>()
      7 my_bucket = s3.Bucket('arn:aws:s3:::unidata-nexrad-level2-chunks')
      8 
----> 9 for objects in my_bucket.objects.all():
     10     print(objects)

11 frames
/usr/local/lib/python3.6/dist-packages/botocore/handlers.py in validate_bucket_name(params, **kwargs)
    226             'the regex "%s" or be an ARN matching the regex "%s"' % (
    227                 bucket, VALID_BUCKET.pattern, VALID_S3_ARN.pattern))
--> 228         raise ParamValidationError(report=error_msg)
    229 
    230 

ParamValidationError: Parameter validation failed:
Invalid bucket name "arn:aws:s3:::unidata-nexrad-level2-chunks": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$" or be an ARN matching the regex "^arn:(aws).*:s3:[a-z\-0-9]+:[0-9]{12}:accesspoint[/:][a-zA-Z0-9\-]{1,63}$"

我对要使用的 aws 存储桶名称感到困惑,因为这是文档https://registry.opendata.aws/noaa-nexrad/ 中提到的名称

2) 我想访问这个存储桶并下载存储桶中存在的所有对象。尽管此存储桶具有公共访问权限,但我是否需要任何类型的身份验证密钥?

谢谢!

编码器

还有另一种方法可以在不使用 boto 的情况下执行此操作:

import nexradaws
conn = nexradaws.NexradAwsInterface()
conn.get_avail_scans('2020', '01', '01', 'KLTX')

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何使用python boto3将s3对象从一个存储桶复制到另一个存储桶

列出使用Python和Boto3的S3存储桶的目录内容吗?

使用boto3,Python从S3存储桶中查找最新的CSV文件

我们可以使用boto3 Python在aws s3存储桶之间递归复制文件和文件夹吗?

Python AWS Boto3:如何从S3存储桶读取文件?

Lambda Python boto3将文件存储在S3存储桶中

使用boto3访问其他AWS用户S3存储桶

如何使用python(boto3)连接到带有pem文件的Amazon S3存储桶

boto3 aws检查s3存储桶是否已加密

如何使用boto3在s3存储桶上的aws文件上传中获得成功的响应?

python boto3:AWS Rekognition无法访问S3存储桶

使用Python boto3在大量存储桶上进行S3默认服务器端加密

Spring Boot无法连接到AWS S3存储桶-IAM凭证正确

如何使用boto3将Github上的文件上传到AWS S3存储桶?

使用boto3和python从S3存储桶目录中仅读取特定格式的文件

无法使用Boto连接AWS S3存储桶

尝试使用python2.7中的boto3模块从S3存储桶和S3存储桶获取CSV文件时出现无效的时间戳记错误

使用 boto3(python 3.x) 将文件上传到 aws s3 存储桶以保持文件结构?

无法使用 boto3 python 更改 AWS S3 内容类型元数据

使用 boto3 从 AWS S3 存储桶下载 - 时间戳格式不正确

如何使用 Python Boto3 获取 S3 存储桶的总数

使用 AWS S3 存储桶将多个对象连接到单个 Pandas 数据帧中

使用 boto3 连接到 S3 兼容存储

如何使用 Python 从公共 AWS S3 存储桶中提取文件

使用python删除s3存储桶内容的AWS lambda函数

无法使用 boto3 连接到 AWS Cloudfront

如何使用 boto3 同步 AWS S3 存储桶和本地文件夹

使用 boto3 和 python 列出 s3 存儲桶

使用 Boto3 和 Python 将 tar.gz 文件上传到 S3 存储桶