The get-bucket-stat command lets you retrieve statistical details for buckets, such as the total storage capacity utilized and the number of objects stored within. This command is applicable to scenarios such as regular capacity monitoring, resource usage assessment, and cost optimization.
Notes
By default, an Alibaba Cloud account has permissions to query the storage usage and number of objects within a bucket. To make query requests as a RAM user, the
oss:GetBucketStat
permission is required. For details, see Attach a custom policy to a RAM user.The displayed output may not represent real-time information. There could be a delay of over one hour between the actual state and the data presented.
Syntax
ossutil api get-bucket-stat --bucket value [flags]
Parameter | Type | Description |
--bucket | string | The name of the bucket. |
The get-bucket-stat command is fundamentally implemented based on the GetBucketStat operation. For information about the parameters within, see GetBucketStat.
In addition to the --bucket parameter, this command also supports parameters in the global command-line options.
Examples
Query the storage usage of examplebucket and the number of objects stored within.
ossutil api get-bucket-stat --bucket examplebucket
Query the storage usage of examplebucket and the number of objects stored within, the output formatted in JSON.
ossutil api get-bucket-stat --bucket examplebucket --output-format json
Query the storage usage of examplebucket and the number of objects stored within, the output formatted in YAML.
ossutil api get-bucket-stat --bucket examplebucket --output-format yaml