Use the lrb command to retrieve basic information about buckets in one or more regions. This information includes bucket names, creation times, storage classes, and the total number of buckets.
Usage notes
-
To list buckets, you must have the oss:ListBuckets permission. For more information, see Attach a custom policy to a RAM user.
-
For ossutil 1.6.16 or later, you can use ossutil as the binary name in the command line. You do not need to update the binary name for your operating system. For versions earlier than 1.6.16, you must update the binary name. For more information, see the ossutil command reference.
Command format
ossutil lrb conf_file [-e <value>]
The following table describes the parameters and options in the command.
|
Parameter |
Description |
|
conf_file |
To get information about buckets in multiple regions, specify a local configuration file. In the file, enter the Endpoint for each region on a new line. |
|
-e |
To get information about buckets in a single region, use this option to specify the Endpoint of the region. |
Examples
-
Retrieve information about buckets in a single region
Retrieve information about buckets in the China (Hangzhou) region.
ossutil lrb -e oss-cn-hangzhou.aliyuncs.comRetrieve information about buckets in the region that is associated with the Endpoint specified in the ossutil configuration file. For more information about the Endpoint in the ossutil configuration file, see the config command.
ossutil lrb -
Retrieve information about buckets in multiple regions
-
Create a local file and configure the Endpoint information in the file.
Create a local file named
localfile.txt. In the file, enter the Endpoints of the regions for which you want to retrieve bucket information. Thelocalfile.txtfile is configured as follows:oss-cn-hangzhou.aliyuncs.com oss-cn-shenzhen.aliyuncs.com oss-cn-shanghai.aliyuncs.com -
Retrieve information about buckets in the China (Hangzhou), China (Shenzhen), and China (Shanghai) regions.
ossutil lrb localfile.txt
-
-
Sample output
If the command is successful, the output includes the bucket name, creation time, storage class, number of buckets, and the time elapsed. The following sample output is for retrieving information about buckets in 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
To access a bucket in a different region, use -e to specify the endpoint. To access a bucket owned by a different Alibaba Cloud account, use -i for the AccessKey ID and -k for the AccessKey secret.
For example, to retrieve information about buckets in the China (Shanghai) region that belong to another Alibaba Cloud account, run the following command:
ossutil lrb -e oss-cn-shanghai.aliyuncs.com -i yourAccessKeyID -k yourAccessKeySecret