Lists all buckets owned by the requester.
Usage notes
To run this command, you need the
oss:ListBuckets(GetService)permission. For details, see Attach a custom policy to a RAM user.Use
--prefix,--marker, or--max-keysto filter results.When all buckets fit in a single response, the XML output does not include
Prefix,Marker,MaxKeys,IsTruncated, orNextMarkerelements.
Syntax
ossutil api list-buckets [flags]| Flag | Type | Description |
|---|---|---|
--prefix | string | Return only buckets whose names contain this prefix. |
--marker | string | Return buckets whose names come after this value alphabetically. |
--max-keys | int | Maximum number of buckets to return per request. |
--resource-group-id | string | Return only buckets that belong to this resource group. |
list-buckets maps to the ListBuckets(GetService) API operation. For global command-line options, see Global command-line options.Examples
List all buckets:
ossutil api list-bucketsList all buckets in JSON format:
ossutil api list-buckets --output-format jsonList all buckets in YAML format:
ossutil api list-buckets --output-format yamlList buckets whose names start with example:
ossutil api list-buckets --prefix exampleList the first 100 buckets:
ossutil api list-buckets --max-keys 100List buckets after examplebucket alphabetically:
ossutil api list-buckets --marker examplebucketList buckets in a specific resource group:
ossutil api list-buckets --resource-group-id rg-123