All Products
Search
Document Center

Object Storage Service:Query the region of a bucket

Last Updated:Jul 31, 2024

Queries the region of a bucket.

Usage notes

  • Only the owner of a bucket can query the region in which the bucket is located.

  • To query the region of a bucket, you must have the oss:GetBucketLocation permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

 ossutil api get-bucket-location --bucket value [flags]

Parameter

Type

Description

--bucket

string

The name of the bucket.

Note

For more information, see Command-line options.

Examples

Query the region of the examplebucket bucket.

ossutil api get-bucket-location --bucket examplebucket

The output shows that the bucket is located in the China (Hangzhou) region.

<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint>oss-cn-hangzhou</LocationConstraint>