擅长:python、mysql、java
<p>对于boto3,您可以使用get_bucket_location方法,该方法将返回给您以下之一(截至2019年11月):</p>
<p>'EU'|'EU-west-1'|'us-west-1'|'us-west-2'|'ap-south-1'|'ap-south-1'|'ap-south-2'|'ap-东北-1'|'sa-east-1'|'cn-north-1'|'EU-central-1'</p>
<p>示例方法如下:</p>
<pre><code>def get_location(client, bucket_name):
response = client.get_bucket_location(Bucket=bucket_name)
return response['LocationConstraint']
</code></pre>
<p>请参阅<a href="https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_bucket_location" rel="nofollow noreferrer">documentation for more info</a>。</p>