Creates a resource group.

Note A maximum of 30 resource groups can be created under an Alibaba Cloud account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateResourceGroup

The operation that you want to perform. Set the value to CreateResourceGroup.

DisplayName String Yes my-project

The display name of the resource group.

The name must be 1 to 30 characters in length and can contain letters, digits, periods (.), at signs (@), and hyphens (-).

Name String Yes my-project

The unique identifier of the resource group.

The identifier must be 3 to 12 characters in length and can contain letters, digits, periods (.), hyphens (-), and underscores (_). The identifier must start with a letter.

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

ResourceGroup Struct

The information of the resource group.

AccountId String 123456789****

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

CreateDate String 2015-01-23T12:33:18Z

The time when the resource group was created.

DisplayName String my-project

The display name of the resource group.

Id String rg-9gLOoK****

The ID of the resource group.

Name String my-project

The unique identifier of the resource group.

RegionStatuses Array

The status of the resource group in all regions.

RegionStatus
RegionId String cn-qingdao

The region ID.

Status String Creating

The status of the resource group. Valid values:

  • Creating: The resource group is being created.
  • OK: The resource group is created.
  • Deleted: The resource group is deleted.
  • Deleting: The resource group is being deleted.
  • PendingDelete: The resource group is waiting for deletion.
Status String Creating

The status of the resource group. Valid values:

  • Creating: The resource group is being created.
  • OK: The resource group is created.
  • Deleted: The resource group is deleted.
  • Deleting: The resource group is being deleted.
  • PendingDelete: The resource group is waiting for deletion.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=CreateResourceGroups
&Name=my-project
&DisplayName=my-project
&<Common request parameters>

Sample success responses

XML format

<CreateResourceGroupResponse>
      <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
      <ResourceGroup>
            <Id>rg-9gLOoK****</Id>
            <AccountId>123456789****</AccountId>
            <Name>my-project</Name>
            <DisplayName>my-project</DisplayName>
            <Status>Creating</Status>
            <RegionStatuses>
                  <RegionStatus>
                        <RegionId>cn-hangzhou</RegionId>
                        <Status>OK</Status>
                  </RegionStatus>
                  <RegionStatus>
                        <RegionId>cn-qingdao</RegionId>
                        <Status>Creating</Status>
                  </RegionStatus>
            </RegionStatuses>
            <CreateDate>2015-01-23T12:33:18Z</CreateDate>
      </ResourceGroup>
</CreateResourceGroupResponse>

JSON format

{
    "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
    "ResourceGroup": {
        "Id": "rg-9gLOoK****",
        "AccountId": "123456789****",
        "Name": "my-project",
        "DisplayName": "my-project",
        "Status": "Creating",
        "RegionStatuses":{
           "RegionStatus":[
               {
                 "RegionId":"cn-hangzhou",
                 "Status":"OK"
               },
               {
                 "RegionId":"cn-qingdao",
                 "Status":"Creating"
               }
           ]
        },
        "CreateDate": "2015-01-23T12:33:18Z"
    }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParameter.Name.InvalidChars The specified resource group name is invalid. The name must be 1 to 30 characters in length and can contain letters and digits. The error message returned because the resource group name is invalid. The name must be 1 to 30 characters in length and can contain letters and digits.
400 InvalidParameter.Name.Length The maximum length of Name is exceeded. The error message returned because the length of the value specified for the Name parameter has exceeded the upper limit.
400 InvalidParameter.DisplayName.Length The maximum length of DisplayName is exceeded. The error message returned because the length of the value specified for the DisplayName parameter has exceeded the upper limit.
409 LimitExceeded.ResourceGroup Failed to create the resource group because the maximum number of resource groups is exceeded. You can create a maximum of 30 resource groups. The error message returned because the maximum number of resource groups has been reached. A maximum of 30 resource groups can be created.

For a list of error codes, visit the API Error Center.