You can call this operation to view the location information of a bucket. Only the bucket owner can view the location information of a bucket.

Request structure

GET /? location HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Response elements

Element Type Description
LocationConstraint String The region where a bucket is located.

Valid values: oss-cn-hangzhou, oss-cn-shanghai, oss-cn-qingdao, oss-cn-beijing, oss-cn-zhangjiakou, oss-cn-hongkong, oss-cn-shenzhen, oss-us-west-1, oss-us-east-1, and oss-ap-southeast-1.

Note For more information about the mapping between the region and data center of a bucket , see Regions and endpoints.

Examples

Sample requests
Get /? location HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 04 May 2012 05:31:04 GMT  
Authorization: OSS qn6qrrqxo2oawuk53otf****:ceOEyZavKY4QcjoUWYSpYbJ3****                
Sample responses
HTTP/1.1 200
x-oss-request-id: 534B371674E88A4D8906****
Date: Fri, 15 Mar 2013 05:31:04 GMT
Connection: keep-alive
Content-Length: 90 
Server: AliyunOSS

<? xml version="1.0" encoding="UTF-8"? >
<LocationConstraint xmlns=”http://doc.oss-cn-hangzhou.aliyuncs.com”>oss-cn-hangzhou</LocationConstraint >

SDK

SDKs of the GetBucketLocation operation for various programming languages:

Error codes

Error code HTTP status code Description
AccessDenied 403 The error message returned because you are not authorized to view the location information of the specified bucket. Only the bucket owner can view the location information of a bucket.