Configures the resource group to which a bucket belongs.

Usage notes

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

Request structure

PUT /?resourceGroup
Date: GMT Date
Content-Length: ContentLength
Content-Type: application/xml
Host: BucketName.oss.aliyuncs.com
Authorization: SignatureValue 
<?xml version="1.0" encoding="UTF-8"?>
<BucketResourceGroupConfiguration>
  <ResourceGroupId>rg-aekz****</ResourceGroupId>
</BucketResourceGroupConfiguration>

Request headers

Request headers involved in this API operation contain only common request headers. For more information, see Common request headers.

Request elements

ElementTypeRequiredExampleDescription
BucketResourceGroupConfigurationContainerYesN/AThe container that contains the ID of the resource group.

Child nodes: ResourceGroupId

ResourceGroupIdStringYesrg-aekz****The ID of the resource group to which the bucket belongs.

If this element is not specified, the bucket is moved to the default resource group.

Parent nodes: BucketResourceGroupConfiguration

Response headers

The response headers involved in this API operation contain only common response headers. For more information, see Common response headers.

Examples

Sample requests
PUT /?resourceGroup
Content-Length: 0
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Sat, 8 May 2021 01:33:47 GMT
Authorization: OSS qn6qrrqxo2oawuk5****:77Dvh5wQgIjWjwO/KyRt****
<?xml version="1.0" encoding="UTF-8"?>
<BucketResourceGroupConfiguration>
  <ResourceGroupId>rg-aekz****</ResourceGroupId>
</BucketResourceGroupConfiguration>
Sample responses
HTTP/1.1 200 OK
x-oss-request-id: 5D3663FBB007B79097FC****
Date: Sat, 8 May 2021 01:33:47 GMT
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS

Error codes

Error codeHTTP status codeDescription
AccessDenied403Possible causes:
  • The information for user authentication is not imported when you initiate the request.
  • The error message returned because you are not authorized to perform the PutBucketResourceGroup operation.
ResourceGroupIdPreCheckError400The error message returned because the specified ID of the resource group is invalid or does not exist. The ID of the resource group fails the precheck.