Creating an ECS Group
Function
This API is used to create an ECS group.
Compared with the native API for creating an ECS group, this API supports checking fine-grained permissions for enterprise projects.
Constraints
Only anti-affinity policies are supported.
URI
POST /v1/{project_id}/cloudservers/os-server-groups
| Parameter | Mandatory | Description |
|---|---|---|
| project_id | Yes | Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. |
Request
Table 2 describes the request parameters.
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| server_group | Yes | Object | Specifies the ECS group information. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Specifies the ECS group name. The value contains 1 to 255 characters. |
| policies | Yes | Array of strings | Specifies the policies associated with the ECS group. Options:
NOTE: Only anti-affinity policies are supported. You are not advised to use other policies. If other policies are used, creating the ECS group will fail. |
Response
Table 4 describes the response parameters.
| Parameter | Type | Description |
|---|---|---|
| id | String | Specifies the ECS group UUID. |
| name | String | Specifies the ECS group name. |
| policies | Array of strings | Specifies the policies associated with the ECS group. Options:
|
| members | Array of strings | Specifies the IDs of the ECSs in an ECS group. |
| metadata | Object | Specifies the ECS group metadata. |
Example Request
POST https://{endpoint}/v1/{project_id}/cloudservers/os-server-groups {
"server_group": {
"name": "test",
"policies": ["anti-affinity"]
}
} Example Response
{
"server_group": {
"id": "5bbcc3c4-1da2-4437-a48a-66f15b1b13f9",
"name": "test",
"policies": [
"anti-affinity"
],
"members": [],
"metadata": {}
}
} Returned Values
Error Codes
Last Article: ECS Group Management
Next Article: Deleting an ECS Group
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.