Reputation: 33
I am trying to connect to Nexrad aws bucket using python boto3, I have the following issues:
1)
Code:
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}$"
I am confused about the aws bucket name to use because this is the name mentioned in the documentation https://registry.opendata.aws/noaa-nexrad/
2) I want to access this bucket and download all objects present in the bucket. Will I require any sort of authentication key although this bucket has public access?
Thanks!
Upvotes: 1
Views: 329
Reputation: 33
There's another way to do this without using boto:
import nexradaws
conn = nexradaws.NexradAwsInterface()
conn.get_avail_scans('2020', '01', '01', 'KLTX')
Upvotes: 1