All Products
Search
Document Center

Object Storage Service:get-bucket-resource-group

Last Updated:Aug 30, 2024

Queries the ID of the resource group to which a bucket belongs.

Usage notes

By default, an Alibaba Cloud account has the permissions to query the ID of the resource group to which a bucket belongs. To query the ID of the resource group to which a bucket belongs by using a RAM user or Security Token Service (STS), you must have the oss:GetBucketResourceGroup permission. For more information, see Attach a custom policy to a RAM user.

Command syntax

ossutil api get-bucket-resource-group --bucket value [flags]
Note
  • The get-bucket-resource-group command corresponds to the GetBucketResourceGroup operation. For more information about the parameters in the GetBucketResourceGroup operation, see GetBucketResourceGroup.

  • For more information about supported global command-line options, see Global command-line options.

Examples

  • Run the following command to query the ID of the resource group to which a bucket named examplebucket belongs:

    ossutil api get-bucket-resource-group --bucket examplebucket
  • Run the following command to query the ID of the resource group to which a bucket named examplebucket belongs and display the query results in the JSON format:

    ossutil api get-bucket-resource-group --bucket examplebucket --output-format json
  • Run the following command to query the ID of the resource group to which a bucket named examplebucket belongs and display the query results in the YAML format:

    ossutil api get-bucket-resource-group --bucket examplebucket --output-format yaml