日々精進

新しく学んだことを書き留めていきます

boto3でbucketのregionを取得する

以下でできた。

s3: ServiceResource = boto3.resource('s3')
bucket = s3.Bucket(bucket_name)
bucket.meta.client.get_bucket_location(Bucket=self.bucket_name)['LocationConstraint']

参考: stackoverflow.com