View the region to which a bucket belongs
Updated at:2025-11-03
Bucket Location refers to Bucket Region. For details on regions supported by Baidu AI Cloud, refer to [Region Selection Guide](Reference/Region Selection Instructions/Region.md).
The following code can retrieve the bucket's location information:
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());
