The command put-bucket-resource-group is used to configure the ID of the resource group to which a bucket belongs.
Permissions
By default, an Alibaba Cloud account has full permissions. RAM users or RAM roles under an Alibaba Cloud account do not have any permissions by default. The Alibaba Cloud account or account administrator must grant operation permissions through RAM Policy or Bucket Policy.
API | Action | Description |
PutBucketResourceGroup |
| Configures a resource group for a bucket. |
Command syntax
ossutil api put-bucket-resource-group --bucket value [flags]
Parameter | Type | Description |
--bucket | string | The bucket for which you want to modify the ID of the resource group. |
--resource-group-configuration | string | The container that stores the ID of the resource group. |
The put-bucket-resource-group command corresponds to the PutBucketResourceGroup operation. For more information about the parameters within, see PutBucketResourceGroup.
--resource-group-configuration
The --resource-group-configuration option supports both XML and JSON formats. If the value of the option contains the 'file://' prefix, configuration parameters are read from the specified file.
XML format:
<BucketResourceGroupConfiguration> <ResourceGroupId>string</ResourceGroupId> </BucketResourceGroupConfiguration>
JSON format:
{ "ResourceGroupId": "string" }
For more information about supported global command-line options, see Command-line options.
Examples
The following examples show how to configure the ID of the resource group to which examplebucket
belongs as rg-123
.
Create a configuration file named resource-group-configuration.xml and add the following code:
<?xml version="1.0" encoding="UTF-8"?> <BucketResourceGroupConfiguration> <ResourceGroupId>rg-123</ResourceGroupId> </BucketResourceGroupConfiguration>
Sample command:
ossutil api put-bucket-resource-group --bucket examplebucket --resource-group-configuration file://resource-group-configuration.xml
Create a configuration file named antiddos-configuration.json and add the following code:
{ "ResourceGroupId": "rg-123" }
Sample command:
ossutil api put-bucket-resource-group --bucket examplebucket --resource-group-configuration file://resource-group-configuration.json
Configure parameters in the following command in the JSON format:
ossutil api put-bucket-resource-group --bucket examplebucket --resource-group-configuration "{\"ResourceGroupId\":\"rg-123\"}"