Boto get basket location s3

Is it possible to get bucket location in s3 using boto API?

I'm talking about this feature from the AWS API - http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html

Thanks in advance.

+4
source share
1 answer

You can call the get_location () method:

conn = boto.connect_s3()
bucket = conn.get_bucket(bucket_name)
bucket_location = bucket.get_location()
if bucket_location:
    conn = boto.s3.connect_to_region(bucket_location)
    bucket = conn.get_bucket(bucket_name)

http://boto.cloudhackers.com/en/latest/ref/s3.html#boto.s3.bucket.Bucket.get_location

+5
source

Source: https://habr.com/ru/post/1624430/


All Articles