Help Center/ Cloud Eye/ API Reference/ API V1/ Resource Groups/ Creating a Resource Group
Updated on 2025-11-20 GMT+08:00

Creating a Resource Group

Function

This API is used to create a resource group. With resource groups, you can easily manage resources by service and view monitoring and alarm information by group.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    ces:resourceGroups:create

    Write

    -

    g:EnterpriseProjectId

    -

    -

URI

POST /V1.0/{project_id}/resource-groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints

N/A

Range

1 to 64 characters

Default Value

Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type.

X-Auth-Token

No

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

group_name

Yes

String

Definition

Resource group name.

Constraints

N/A

Range

The value allows 1 to 128 characters. It can only contain letters, digits, hyphens (-), and underscores (_).

Default Value

N/A

resources

No

Array of CreateResourceGroup objects

Definition

Resource details when resources are manually added.

Constraints

A maximum of 1,000 resources are allowed.

type

No

String

Definition

Method for adding resources to a resource group.

Constraints

N/A

Range

The value can only be EPS (synchronizing resources from enterprise projects) or TAG (dynamic tag matching). If this parameter is not specified, resources are manually added.

Default Value

N/A

relation_ids

No

Array of strings

Definition

ID of the enterprise project from which resources in the resource group come.

Constraints

This parameter is mandatory when type is set to EPS. The value can contain a maximum of 50 enterprise project IDs.

tags

No

Array of ResourceGroupTagRelation objects

Definition

Associated tags during dynamic tag matching.

Constraints

This parameter is mandatory when type is set to TAG. A maximum of 50 tags are allowed.

enterprise_project_id

No

String

Definition

ID of the enterprise project that a resource group belongs to.

Constraints

N/A

Range

The value can be 0 (default enterprise project ID) or consists of digits, letters, or hyphens (-).

Default Value

N/A

Table 4 CreateResourceGroup

Parameter

Mandatory

Type

Description

namespace

Yes

String

Definition

Namespace of a service. For details about the namespace of each service, see Namespaces.

Constraints

N/A

Range

The value is in the service.item format. The values of service and item must be a string, starting with a letter and containing only digits (0–9), letters (case-insensitive), and underscores (_). It must contain 3 to 32 characters.

Default Value

N/A

dimensions

Yes

Array of MetricsDimension objects

Definition

Resource dimension information.

Constraints

A maximum of four dimensions are allowed.

Table 5 MetricsDimension

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service Metric Dimensions.

Constraints

N/A

Range

The value starts with a letter and allows 1 to 32 characters. It can contain letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

value

Yes

String

Definition

Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

Constraints

N/A

Range

1 to 256 characters

Default Value

N/A

Table 6 ResourceGroupTagRelation

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

TMS tag key specifications.

Constraints

N/A

Range

[1,128]

Default Value

N/A

operator

No

String

Definition

Tag operator, which indicates the relationship between the tag key and value.

Constraints

N/A

Range

  • include: include

  • prefix: prefix

  • suffix: suffix

  • notInclude: not included

  • equal: equal. If operator is equal and value is an empty string, all tag values of the key are matched.

  • all: all

Default Value

N/A

value

No

String

Definition

TMS tag value specifications.

Constraints

N/A

Range

0 to 43 characters

Default Value

N/A

Response Parameters

Status code: 201

Table 7 Response body parameters

Parameter

Type

Description

group_id

String

Definition

Resource group ID, for example, rg1606377637506DmVOENVyL.

Constraints

N/A

Range

The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both.

Default Value

N/A

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

-

String

Request error.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

-

String

The authentication information is not provided or is incorrect.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

-

String

Access to the requested page is forbidden.

Status code: 408

Table 11 Response body parameters

Parameter

Type

Description

-

String

The request timed out.

Status code: 429

Table 12 Response body parameters

Parameter

Type

Description

-

String

Too many requests.

Status code: 500

Table 13 Response body parameters

Parameter

Type

Description

-

String

Failed to complete the request because of an internal service error.

Status code: 503

Table 14 Response body parameters

Parameter

Type

Description

-

String

The system is currently unavailable.

Example Requests

{
  "group_name" : "Resource-Group-Test01",
  "resources" : [ {
    "namespace" : "SYS.ECS",
    "dimensions" : [ {
      "name" : "instance_id",
      "value" : "063a83da-a2b5-4630-ab6b-9b4fcfc261ea"
    } ]
  }, {
    "namespace" : "SYS.ECS",
    "dimensions" : [ {
      "name" : "instance_id",
      "value" : "518ace88-abde-46bf-829b-0d1f0f2fb2e9"
    } ]
  } ]
}

Example Responses

Status code: 201

OK

{
  "group_id" : "rg1606377637506DmVOENVyL"
}

Status Codes

Status Code

Description

201

OK

400

Bad Request

401

Unauthorized

403

Forbidden

408

Request Timeout

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Error Codes

See Error Codes.