I have just created a bucket with AWS CLI:
aws s3 mb s3://new-bucket-created
And then when listing all buckets in my S3 account with boto3:
s3 = boto3.client('s3')
response = s3.list_buckets()
buckets = {}
for bucket in response['Buckets']:
bucket_name = bucket["Name"]
bucket_region = s3.get_bucket_location(Bucket=bucket_name)['LocationConstraint']
buckets.update({bucket_name:bucket_region})
for bucket, region in buckets.items():
print("{}, {}".format(bucket, region))
the output shows all older buckets with region specified as sa-east-1 but the newer is None:
Output
older-bucket, sa-east-1
another-older-bucket, sa-east-1
yet-another-older-bucket, sa-east-1
new-bucket-created, None
I can write in that new-bucket-created, but why can't i see its region? Sure there's a place, any thoughts?
s3.get_bucket_locationmight return None? - OneCricketeer