百度智能云

All Product Document

          Object Storage

          Acquisition of Bucket Region Information

          Basic Introduction

          You can get the region where the storage space (bucket) is located, that is, the physical location information of the data center through getbucketLocation interface of the BOS API. For details of regions supported by Baidu AI Cloud, please refer to Region Selection Instructions.

          Operation Method

          You can view the bucket region information through the console. At meanwhile, BOS also supports getting the region information of bucket through API and SDK, as shown below:

          • Viewing bucket region information through the console 1.Log in to the MMC and enter "Product > Cloud Base > Baidu Object Storage". 2.You can click the bucket you want to view in the "Storage Management" on the left side of the console page, and view the region information of bucket in the title bar of the bucket details on the right side. Or hover your mouse over the bucket you want to view and the region information will pop up automatically.
          • View Bucket Region through GetBucketLocation Interface.
          • View bucket region through SDK

          Example

          Below are the example codes for Java SDK:

          BosClient client = new BosClient(config);
          ListBucketsResponse listBucketsResponse =  client.listBuckets();
          List<BucketSummary> bucketSummaryList =  listBucketsResponse.getBuckets();
          for(BucketSummary bs : bucketSummaryList) {
              System.out.println( bs.getLocation());
          }
          System.out.println(client.getBucketLocation("bucket-test").getLocationConstraint());
          Previous
          Delete Bucket
          Next
          Set Cross-Origin Resource Sharing (CORS)