• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. OpenStack Nova APIs
  5. ECS Group Management
  6. Creating an ECS Group

Creating an ECS Group

Function Description

This interface is used to create an ECS group.

Constraints

Only anti-affinity groups are supported.

URI

POST /v2/{project_id}/os-server-groups

POST /v2.1/{project_id}/os-server-groups

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

Request

Request parameters

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

server_group

Dict

Yes

Specifies the ECS group information.

Table 3 server_group field description

Parameter

Type

Mandatory

Description

name

String

Yes

Specifies the ECS group name. The value contains 1 to 255 characters.

policies

List(String)

Yes

Specifies the policies associated with an ECS group. Options:

  • anti-affinity: ECSs in this group must be deployed on different hosts.
  • affinity: ECSs in this group must be deployed on the same host.
  • soft-anti-affinity: ECSs in this group are deployed on different hosts if possible. If the ECSs cannot be deployed on different hosts, deploy them based on the actual condition for successful ECS creation.
  • soft-affinity: ECSs in this group are deployed on the same host if possible. If the ECSs cannot be deployed on the same host, deploy them based on the actual condition for successful ECS creation.
    NOTE:

    Only the anti-affinity policy is supported.

Response

Response parameters

Table 4 describes the response parameters.

Table 4 Response parameters

Parameter

Type

Description

server_group

Dict

Specifies the ECS group information.

Table 5 server_group field description

Parameter

Type

Description

id

String

Specifies the ECS group UUID.

name

String

Specifies the ECS group name.

policies

List(String)

Specifies the policies associated with an ECS group. Options:

anti-affinity: ECSs in this group must be deployed on different hosts.

affinity: ECSs in this group must be deployed on the same host.

soft-anti-affinity: ECSs in this group are deployed on different hosts if possible. If the ECSs cannot be deployed on different hosts, deploy them based on the actual condition for successful ECS creation.

soft-affinity: ECSs in this group are deployed on the same host if possible. If the ECSs cannot be deployed on the same host, deploy them based on the actual condition for successful ECS creation.

members

List(String)

Specifies the ECSs in an ECS group.

metadata

Dict

Specifies the ECS group metadata.

project_id

String

Specifies the tenant ID in UUID format for the ECS group.

NOTE:

This parameter is added in microversion 2.13.

user_id

String

Specifies the user ID in UUID format for the ECS group.

NOTE:

This parameter is added in microversion 2.13.

Examples

  • Example request
    POST /v2/9c53a566cb3443ab910cf0daebca90c4/os-server-groups
    POST /v2.1/9c53a566cb3443ab910cf0daebca90c4/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

See General Request Returned Values.