Updated on 2024-08-19 GMT+08:00

Creating a Backend Server Group

Function

This API is used to create a backend server group.

Constraints

If session-persistence is specified, cookie_name is available only when type is set to APP_COOKIE.

If listener_id is specified, the listener must have no backend server group associated.

Calling Method

For details, see Calling APIs.

URI

POST /v3/{project_id}/elb/pools

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the token used for IAM authentication.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

pool

Yes

CreatePoolOption object

Specifies the request body for creating a backend server group.

Table 4 CreatePoolOption

Parameter

Mandatory

Type

Description

admin_state_up

No

Boolean

Specifies the administrative status of the backend server group. The value can only be updated to true.

description

No

String

Provides supplementary information about the backend server group.

Minimum: 0

Maximum: 255

lb_algorithm

Yes

String

Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group.

The value can be one of the following:

  • ROUND_ROBIN: weighted round robin

  • LEAST_CONNECTIONS: weighted least connections

  • SOURCE_IP: source IP hash

  • QUIC_CID: connection ID

  • 2_TUPLE_HASH: 2-tuple hash that is only available for IP backend server groups

  • 3_TUPLE_HASH: 3-tuple hash that is only available for IP backend server groups

  • 5_TUPLE_HASH: 5-tuple hash that is only available for IP backend server groups Note:

  • If the value is SOURCE_IP, the weight parameter will not take effect for backend servers.

  • QUIC_CID is supported only when the protocol of the backend server group is QUIC.

QUIC_CID is not supported.

listener_id

No

String

Specifies the ID of the listener with which the backend server group is associated. Specify either listener_id or loadbalancer_id, or both of them.

Minimum: 1

Maximum: 36

loadbalancer_id

No

String

Specifies the ID of the load balancer with which the backend server group is associated.

Minimum: 1

Maximum: 36

name

No

String

Specifies the backend server group name.

Minimum: 0

Maximum: 255

project_id

No

String

Specifies the project ID of the backend server group.

Minimum: 1

Maximum: 32

protocol

Yes

String

Specifies the protocol used by the backend server group to receive requests.

The value can be TCP, UDP, IP, TLS, HTTP, HTTPS, gRPC, or QUIC.

Note:

  • If the listener's protocol is UDP, the protocol of the backend server group must be UDPor QUIC.

  • If the listener's protocol is TCP, the protocol of the backend server group must be TCP.

  • If the listener's protocol is IP, the protocol of the backend server group must be IP.

  • If the listener's protocol is HTTP, the protocol of the backend server group must be HTTP.

  • If the listener's protocol is HTTPS, the protocol of the backend server group can be HTTP, HTTPS, or gRPC.

  • If the listener's protocol is TERMINATED_HTTPS, the protocol of the backend server group must be HTTP.

  • If the listener's protocol is QUIC, the protocol of the backend server group can be HTTP, HTTPS, or gRPC.

  • If the listener's protocol is TLS, the protocol of the backend server group can be TLS or TCP. If protocol of the backend server group is TCP, the ip_version must be set to v4.

Note:

  • If protocol of the backend server group is QUIC, session_persistence must be set to true, with type set to SOURCE_IP.

  • If protocol of the backend server group is gRPC, http2_enable of the listener must be set to true. QUIC is not supported.

Minimum: 1

Maximum: 255

session_persistence

No

CreatePoolSessionPersistenceOption object

Specifies the sticky session.

slow_start

No

CreatePoolSlowStartOption object

Specifies slow start details. After you enable slow start, new backend servers added to the backend server group are warmed up, and the number of requests they can receive increases linearly during the configured slow start duration.

This parameter can be used when the protocol of the backend server group is HTTP or HTTPS. An error will be returned if the protocol is not HTTP or HTTPS.

This parameter is not supported by gateway load balancers. Please do not use it.

member_deletion_protection_enable

No

Boolean

Specifies whether to enable removal protection for the load balancer.

  • true: Enable removal protection.

  • false (default): Disable removal protection.

NOTE:

Disable removal protection for all your resources before deleting your account.

This parameter is unsupported. Please do not use it.

vpc_id

No

String

Specifies the ID of the VPC where the backend server group works.

Note:

  • The backend server group must be associated with the VPC.

  • Only backend servers in the VPC or IP as backend servers can be added.

  • type must be set to instance.

  • vpc_id must be specified for IP backend server groups. The value must be the same as that defined by vpc_id for the load balancer.

  • If vpc_id is not specified, vpc_id is determined by the VPC where the backend server works.

Minimum: 0

Maximum: 36

type

No

String

Specifies the type of the backend server group.

Values:

  • instance: Any type of backend servers can be added. vpc_id is mandatory.

  • ip: Only IP as backend servers can be added. vpc_id cannot be specified. type cannot be set to ip if the backend server group protocol is IP.

Note:

  • If this parameter is not passed, any type of backend servers can be added. type will be returned as an empty string.

  • Specify one of listener_id, loadbalancer_id, or type.

Minimum: 0

Maximum: 36

ip_version

No

String

Specifies the IP address version supported by the backend server group.

Minimum: 1

Maximum: 20

target_rebalance

No

Boolean

Specifies whether to enable target_rebalance. If this option is enabled, traffic is redirected to a new backend server if a backend server goes offline or is removed.

Note:

  • This parameter is supported only by IP backend server groups. The default value is false.

Default: false

Table 5 CreatePoolSessionPersistenceOption

Parameter

Mandatory

Type

Description

cookie_name

No

String

Specifies the cookie name.

This parameter is not supported by gateway load balancers. Please do not use it. The name can contain a maximum of 255 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

Note:

This parameter will take effect only when type is set to APP_COOKIE. Otherwise, an error will be returned.

This parameter is unsupported. Please do not use it.

type

Yes

String

Specifies the sticky session type. The value can be SOURCE_IP, HTTP_COOKIE, or APP_COOKIE.

Note:

  • If the protocol of the backend server group is TCP or UDP, only SOURCE_IP takes effect.

  • If the protocol of the backend server group is HTTP or HTTPS, the value can only be HTTP_COOKIE.

persistence_timeout

No

Integer

Specifies the stickiness duration, in minutes. This parameter will not take effect when type is set to APP_COOKIE.

  • If the protocol of the backend server group is TCP, UDP, or QUIC, the value ranges from 1 to 60, and the default value is 1.

  • If the protocol of the backend server group is HTTP or HTTPS, the value ranges from 1 to 1440, and the default value is 1440.

QUIC protocol is not supported.

Table 6 CreatePoolSlowStartOption

Parameter

Mandatory

Type

Description

enable

No

Boolean

Specifies whether to enable slow start.

  • true: Enable slow start.

  • false: Disable slow start.

Default: false

duration

No

Integer

Specifies the slow start duration, in seconds.

The value ranges from 30 to 1200, and the default value is 30.

Minimum: 30

Maximum: 1200

Default: 30

Response Parameters

Status code: 201

Table 7 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID. The value is automatically generated.

pool

Pool object

Specifies the backend server group.

Table 8 Pool

Parameter

Type

Description

admin_state_up

Boolean

Specifies the administrative status of the backend server group.

description

String

Provides supplementary information about the backend server group.

healthmonitor_id

String

Specifies the ID of the health check configured for the backend server group.

id

String

Specifies the backend server group ID.

lb_algorithm

String

Specifies the load balancing algorithm used by the load balancer to route requests to backend servers in the associated backend server group.

The value can be one of the following:

  • ROUND_ROBIN: weighted round robin

  • LEAST_CONNECTIONS: weighted least connections

  • SOURCE_IP: source IP hash

  • QUIC_CID: connection ID

  • 2_TUPLE_HASH: 2-tuple hash that is only available for IP backend server groups

  • 3_TUPLE_HASH: 3-tuple hash that is only available for IP backend server groups

  • 4_TUPLE_HASH: 4-tuple hash that is only available for IP backend server groups Note:

  • If the value is SOURCE_IP, the weight parameter will not take effect for backend servers.

  • QUIC_CID is supported only when the protocol of the backend server group is QUIC.

QUIC_CID is not supported.

listeners

Array of ListenerRef objects

Specifies the IDs of the listeners with which the backend server group is associated.

loadbalancers

Array of LoadBalancerRef objects

Specifies the IDs of the load balancers with which the backend server group is associated.

members

Array of MemberRef objects

Specifies the IDs of the backend servers in the backend server group.

name

String

Specifies the backend server group name.

project_id

String

Specifies the project ID.

protocol

String

Specifies the protocol used by the backend server group to receive requests.

The value can be TCP, UDP, IP, TLS, HTTP, HTTPS, gRPC, or QUIC.

Note:

  • If the listener's protocol is UDP, the protocol of the backend server group must be UDPor QUIC.

  • If the listener's protocol is TCP, the protocol of the backend server group must be TCP.

  • If the listener's protocol is IP, the protocol of the backend server group must be IP.

  • If the listener's protocol is HTTP, the protocol of the backend server group must be HTTP.

  • If the listener's protocol is HTTPS, the protocol of the backend server group can be HTTP, HTTPS, or gRPC.

  • If the listener's protocol is TERMINATED_HTTPS, the protocol of the backend server group must be HTTP.

  • If the listener's protocol is QUIC, the protocol of the backend server group can be HTTP, HTTPS, or gRPC.

  • If the listener's protocol is TLS, the protocol of the backend server group can be TLS or TCP. If protocol of the backend server group is TCP, the ip_version must be set to v4.

Note:

  • If protocol of the backend server group is QUIC, session_persistence must be set to true, with type set to SOURCE_IP.

  • If protocol of the backend server group is gRPC, http2_enable of the listener must be set to true. QUIC is not supported.

session_persistence

SessionPersistence object

Specifies the sticky session.

ip_version

String

Specifies the IP address version supported by the backend server group.

slow_start

SlowStart object

Specifies slow start details. After you enable slow start, new backend servers added to the backend server group are warmed up, and the number of requests they can receive increases linearly during the configured slow start duration.

This parameter can be used when the protocol of the backend server group is HTTP or HTTPS. An error will be returned if the protocol is not HTTP or HTTPS.

member_deletion_protection_enable

Boolean

Specifies whether to enable removal protection.

  • true: Enable removal protection.

  • false: Disable removal protection.

NOTE:

Disable removal protection for all your resources before deleting your account.

This parameter is unsupported. Please do not use it.

created_at

String

Specifies the time when a backend server group was created. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time).

updated_at

String

Specifies the time when when a backend server group was updated. The format is yyyy-MM-dd'T'HH:mm:ss'Z' (UTC time).

vpc_id

String

Specifies the ID of the VPC where the backend server group works.

type

String

Specifies the type of the backend server group.

Values:

  • instance: Any type of backend servers can be added. vpc_id is mandatory.

  • ip: Only IP as backend servers can be added. vpc_id cannot be specified.

  • "": Any type of backend servers can be added.

enterprise_project_id

String

Specifies the enterprise project ID of the IP address group.

Table 9 ListenerRef

Parameter

Type

Description

id

String

Specifies the listener ID.

Table 10 LoadBalancerRef

Parameter

Type

Description

id

String

Specifies the load balancer ID.

Table 11 MemberRef

Parameter

Type

Description

id

String

Specifies the backend server ID.

Table 12 SessionPersistence

Parameter

Type

Description

cookie_name

String

Specifies the cookie name.

The name can contain a maximum of 255 characters, including letters, digits, underscores (_), hyphens (-), and periods (.).

Note:

This parameter will take effect only when type is set to APP_COOKIE. Otherwise, an error will be returned.

This parameter is unsupported. Please do not use it.

type

String

Specifies the sticky session type. The value can be SOURCE_IP, HTTP_COOKIE, or APP_COOKIE.

Note:

  • If the protocol of the backend server group is TCP or UDP, only SOURCE_IP takes effect.

  • If the protocol of the backend server group is HTTP or HTTPS, the value can only be HTTP_COOKIE.

persistence_timeout

Integer

Specifies the stickiness duration, in minutes. This parameter will not take effect when type is set to APP_COOKIE.

  • If the protocol of the backend server group is TCP, UDP, or QUIC, the value ranges from 1 to 60, and the default value is 1.

  • If the protocol of the backend server group is HTTP or HTTPS, the value ranges from 1 to 1440, and the default value is 1440.

QUIC protocol is not supported.

Table 13 SlowStart

Parameter

Type

Description

enable

Boolean

Specifies whether to enable slow start.

  • true: Enable slow start.

  • false: Disable slow start.

Default: false

duration

Integer

Specifies the slow start duration, in seconds.

The value ranges from 30 to 1200, and the default value is 30.

Minimum: 30

Maximum: 1200

Default: 30

Example Requests

  • Creating a backend server group whose backend protocol is HTTP

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/pools
    
    {
      "pool" : {
        "name" : "My pool",
        "lb_algorithm" : "LEAST_CONNECTIONS",
        "listener_id" : "0b11747a-b139-492f-9692-2df0b1c87193",
        "protocol" : "TCP",
        "member_deletion_protection_enable" : false
      }
    }
  • Creating a backend server group whose backend protocol is TCP

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/pools
    
    {
      "pool" : {
        "name" : "My pool",
        "lb_algorithm" : "LEAST_CONNECTIONS",
        "listener_id" : "0b11747a-b139-492f-9692-2df0b1c87193",
        "protocol" : "HTTP",
        "slow_start" : {
          "enable" : true,
          "duration" : 50
        },
        "member_deletion_protection_enable" : false
      }
    }
  • Creating an IP backend server group for a gateway load balancer

    POST https://{ELB_Endpoint}/v3/99a3fff0d03c428eac3678da6a7d0f24/elb/pools
    
    {
      "pool" : {
        "name" : "My IP pool",
        "lb_algorithm" : "2_tuple_hash",
        "listener_id" : "0b11747a-b139-492f-9692-2df0b1c87193",
        "protocol" : "IP",
        "type" : "instance",
        "target_rebalance" : true,
        "member_deletion_protection_enable" : false
      }
    }

Example Responses

Status code: 201

Normal response to POST requests.

{
  "pool" : {
    "type" : "",
    "vpc_id" : "",
    "lb_algorithm" : "LEAST_CONNECTIONS",
    "protocol" : "TCP",
    "description" : "",
    "admin_state_up" : true,
    "member_deletion_protection_enable" : false,
    "loadbalancers" : [ {
      "id" : "098b2f68-af1c-41a9-8efd-69958722af62"
    } ],
    "project_id" : "99a3fff0d03c428eac3678da6a7d0f24",
    "session_persistence" : null,
    "healthmonitor_id" : null,
    "listeners" : [ {
      "id" : "0b11747a-b139-492f-9692-2df0b1c87193"
    } ],
    "members" : [ ],
    "id" : "36ce7086-a496-4666-9064-5ba0e6840c75",
    "name" : "My pool",
    "ip_version" : "v4",
    "slow_start" : null
  },
  "request_id" : "2d974978-0733-404d-a21a-b29204f4803a"
}

Status Codes

Status Code

Description

201

Normal response to POST requests.

Error Codes

See Error Codes.