Returns the region of a bucket as a LocationConstraint value.
Prerequisites
Before you begin, make sure that you have:
The
oss:GetBucketLocationpermission granted to your RAM user. For configuration steps, see Attach a custom policy to a RAM user
Usage notes
Only the bucket owner can query the bucket's region.
Command syntax
ossutil api get-bucket-location --bucket <bucket-name> [flags]Parameter
| Parameter | Type | Description |
|---|---|---|
--bucket | string | The name of the bucket. |
For available flags, see Command-line options.
Examples
Query the region of examplebucket:
ossutil api get-bucket-location --bucket examplebucketExpected output:
<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint>oss-cn-hangzhou</LocationConstraint>The LocationConstraint value is an enumerated region identifier. In this example, oss-cn-hangzhou indicates the bucket is in China (Hangzhou).