You can run the lrb command to obtain the basic information about buckets within a region or across multiple regions. The basic bucket information includes bucket names, creation time, storage classes, and the number of buckets.
Sample command lines in this topic are based on the 64-bit Linux system. For other systems, replace ./ossutil64 in the commands with the corresponding binary name. For more information, see ossutil.
Command syntax
./ossutil64 lrb conf_file [-e <value>]
The following table describes the parameters that you can configure when you run this command.
Parameter | Description |
conf_file | If you want to obtain the information of buckets across multiple regions, specify a local configuration file and enter the endpoints of these regions in the configuration file. Separate multiple endpoints with line feeds. |
-e | If you want to obtain the information of buckets within a region, set this parameter to the endpoint of the region. |
Examples
Obtain the information of buckets within a region.
Obtain the information of buckets within the China (Hangzhou) region.
./ossutil64 lrb -e oss-cn-hangzhou.aliyuncs.com
Obtain the information of buckets within the region whose endpoint is specified in the ossutil configuration file. For more information about the endpoint specified in the ossutil configuration file, see config.
./ossutil64 lrb
Obtain the information of buckets across multiple regions.
Create a local file and specify the endpoints of these regions in the local file.
Create a local file named
localfile.txt
and enter the endpoints of these regions in which the buckets are located based on the scenario. The following code provides an example on how to configurelocalfile.txt
:oss-cn-hangzhou.aliyuncs.com oss-cn-shenzhen.aliyuncs.com oss-cn-shanghai.aliyuncs.com
Obtain the information of buckets in the China (Hangzhou), China (Shenzhen) and China (Shanghai) regions.
./ossutil64 lrb localfile.txt
Output
After you obtain the information of buckets, the output includes the bucket names, creation time, storage classes, number of buckets, and the time Object Storage Service (OSS) took to return this output. The following output indicates the information of buckets across multiple regions:
CreationTime Region StorageClass BucketName 2021-07-06 14:21:09 +0800 CST oss-cn-hangzhou Standard oss://examplebucket1 2021-07-06 14:21:44 +0800 CST oss-cn-hangzhou Standard oss://examplebucket2 2021-06-16 18:32:32 +0800 CST oss-cn-shanghai Standard oss://examplebucket3 2021-06-30 16:04:41 +0800 CST oss-cn-shanghai Standard oss://examplebucket4 2021-07-07 12:33:35 +0800 CST oss-cn-shenzhen Standard oss://examplebucket5 Bucket Number is: 5 0.124193(s) elapsed
Common options
If you use ossutil to switch to a bucket that is located in another region, add the -e option to the command to specify the endpoint of the region in which the specified bucket is located. If you use ossutil to switch to a bucket that belongs to another Alibaba Cloud account, you can add the -i option to the command to specify the AccessKey ID of the specified account, and add the -k option to the command to specify the AccessKey secret of the specified account.
The following sample command shows how to obtain the information of buckets in the China (Shanghai) region of another Alibaba Cloud account:
./ossutil64 lrb -e oss-cn-shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA**** -k 67DLVBkH7EamOjy2W5RVAHUY9H****
For more information about other common options of this command, see Common options.