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

Usage notes

By default, an Alibaba Cloud account has the permission to query the resource group of a bucket. To query the resource group of a bucket 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.

Request structure

GET /?resourceGroup
Host: BucketName.oss.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

Request headers

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

Response headers

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

Response elements

ElementTypeExampleDescription
BucketResourceGroupConfigurationContainerN/AThe container that contains the ID of the resource group.

Child nodes: ResourceGroupId

ResourceGroupIdStringrg-aek27tc********The ID of the resource group to which the bucket belongs.

If the bucket belongs to the default resource group, the returned resource group ID is rg-default-id.

Parent nodes: BucketResourceGroupConfiguration

Examples

Sample requests
GET /?resourceGroup
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Sat, 8 May 2021 07:51:28 GMT
Authorization: OSS LTAICQmy1********:Rk7tT30yhDO3D************
Sample responses
HTTP/1.1 200 OK
x-oss-request-id: 534B371674E88A4D8906****
Date: Sat, 8 May 2021 07:51:28 GMT
Connection: keep-alive
Content-Length: 531
Server: AliyunOSS
<?xml version="1.0" encoding="UTF-8"?>
<BucketResourceGroupConfiguration>
  <ResourceGroupId>rg-xxxxxx</ResourceGroupId>
</BucketResourceGroupConfiguration>

Error codes

Error codeHTTP status codeDescription
NoSuchBucket404The error message returned because the requested bucket does not exist.
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 GetBucketResourceGroup operation.