Obtaining Bucket Region Information
Updated at:2025-11-03
Overview
You can obtain the region where a bucket (storage space) is located, i.e., the physical location information of the data center, through the getBucketLocation API of the BOS API. For detailed information about the regions supported by Baidu AI Cloud, please refer to Region Selection Instructions.
Operation types
Users can view the region information of a bucket via the console. Meanwhile, BOS also supports obtaining the bucket’s region information using APIs and SDKs. The specific methods are as follows:
-
View the region to which a bucket belongs via the console:
- Sign in to the Baidu AI Cloud Object Storage (BOS) Management Console.
- Click on the bucket you want to view under the "Storage Management" section on the left side of the console page. You can find the bucket's region information in the title bar of the bucket details on the right side. Alternatively, hover your mouse over the bucket, and the region information will appear automatically.
-
Viewing the region of a bucket via the API:
-
Viewing the region of a bucket via the SDK:
- [Java SDK](BOS/SDK/Java-SDK/Bucket management/View the region to which a bucket belongs.md)
- [Python SDK](BOS/SDK/Python-SDK/Bucket management/View the region to which a bucket belongs.md)
- [PHP SDK](BOS/SDK/PHP-SDK/Bucket management.md#View the region to which a bucket belongs)
- [Ruby SDK](BOS/SDK/Ruby-SDK/Bucket management/View the region to which a bucket belongs.md)
- [GO SDK](BOS/SDK/GO-SDK/Bucket management.md#View the region to which a bucket belongs)
- [C++ SDK](BOS/SDK/C++-SDK/Bucket management/View the region to which a bucket belongs.md)
Example
The following is a code example using Java SDK:
Java
1BosClient client = new BosClient(config);
2ListBucketsResponse listBucketsResponse = client.listBuckets();
3List<BucketSummary> bucketSummaryList = listBucketsResponse.getBuckets();
4for(BucketSummary bs : bucketSummaryList) {
5 System.out.println( bs.getLocation());
6}
7System.out.println(client.getBucketLocation("bucket-test").getLocationConstraint());
