All Products
Search
Document Center

Resource Management:DeleteResourceGroup

Last Updated:Jun 05, 2024

Deletes a resource group.

Operation description

Note Before you delete a resource group, you must delete all the resources in it.

In this example, the resource group whose ID is rg-9gLOoK**** is deleted.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ram:DeleteResourceGroupWrite
  • ResourceGroup
    acs:ram:*:{#accountId}:resourcegroup/{#resourceGroupId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceGroupIdstringYes

The ID of the resource group.

You can call the ListResourceGroups operation to obtain the ID.

rg-9gLOoK****

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

1C488B66-B819-4D14-8711-C4EAAA13AC01
ResourceGroupobject

The information of the resource group.

DisplayNamestring

The display name of the resource group.

my-project
Statusstring

The status of the resource group. Valid values:

  • Creating: The resource group is being created.
  • OK: The resource group is created.
  • PendingDelete: The resource group is waiting to be deleted.
PendingDelete
RegionStatusesobject []

The status of the resource group in all regions.

Statusstring

The status of the resource group. Valid values:

  • Creating: The resource group is being created.
  • OK: The resource group is created.
  • PendingDelete: The resource group is waiting to be deleted.
  • Deleting: The resource group is being deleted.
PendingDelete
RegionIdstring

The region ID.

cn-qingdao
AccountIdstring

The ID of the Alibaba Cloud account to which the resource group belongs.

123456789****
Namestring

The unique identifier of the resource group.

my-project
CreateDatestring

The time when the resource group was created. The time is displayed in UTC.

2015-01-23T12:33:18Z
Idstring

The ID of the resource group.

rg-9gLOoK****

Examples

Sample success responses

JSONformat

{
  "RequestId": "1C488B66-B819-4D14-8711-C4EAAA13AC01",
  "ResourceGroup": {
    "DisplayName": "my-project",
    "Status": "PendingDelete",
    "RegionStatuses": {
      "RegionStatus": [
        {
          "Status": "PendingDelete",
          "RegionId": "cn-qingdao"
        }
      ]
    },
    "AccountId": "123456789****",
    "Name": "my-project",
    "CreateDate": "2015-01-23T12:33:18Z",
    "Id": "rg-9gLOoK****"
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.ResourceGroupIdThe ResourceGroupId is invalid.The resource group ID is invalid.
404EntityNotExists.ResourceGroupThe specified resource group does not exist. You must first create a resource group.The specified resource group does not exist. You must first create a resource group.
409DeleteConflict.ResourceGroup.ResourceFailed to delete the resource group because one or more cloud resources exist in the resource group. Try again later after you release the cloud resources.Failed to delete the resource group because one or more cloud resources exist in the resource group. Try again later after you release the cloud resources.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history