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

Creating a Load Balancer

Function

This API is used to create a private network load balancer. After the load balancer is created, its details, such as load balancer ID, IP address, and subnet ID, are returned.

To create a public network load balancer, you also need to call the API for assigning an EIP and associate this IP address to the port bound to the IP address of the private network load balancer.

You can set the enterprise_project_id parameter to perform fine-grained authorization for resources.

URI

POST /v2/{project_id}/elb/loadbalancers

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request

Table 2 Parameter description

Parameter

Mandatory

Type

Description

loadbalancer

Yes

Loadbalancer object

Specifies the load balancer. For details, see Table 3.

Table 3 loadbalancer parameter description

Parameter

Mandatory

Type

Description

name

No

String

Specifies the load balancer name.

The value contains a maximum of 255 characters.

description

No

String

Provides supplementary information about the load balancer.

The value contains a maximum of 255 characters.

tenant_id

No

String

Specifies the ID of the project where the load balancer is used.

The value contains a maximum of 255 characters.

The value must be the same as the value of project_id in the token.

vip_subnet_id

Yes

String

Specifies the ID of the IPv4 subnet where the load balancer works. Obtain the value by listing the subnets (The parameter is neutron_subnet_id). The private IP address of the load balancer is in this subnet.

Only IPv4 subnets are supported.

provider

No

String

Specifies the provider of the load balancer.

The value can only be vlb.

vip_address

No

String

Specifies the private IP address of the load balancer.

This IP address must be the one in the subnet specified by vip_subnet_id. If this parameter is not specified, an IP address is automatically assigned to the load balancer from the subnet specified by vip_subnet_id.

The value contains a maximum of 64 characters.

admin_state_up

No

Boolean

Specifies the administrative status of the load balancer.

This parameter is reserved, and the default value is true.

enterprise_project_id

No

String

Specifies the enterprise project ID. When creating a load balancer, you can assign an enterprise project to the load balancer.

The value is character string 0 or a UUID with hyphens (-). Value 0 indicates the default enterprise project.

The default value is 0.

protection_status

No

String

Specifies whether modification protection is enabled. The value can be one of the following:

  • nonProtection (default) : Modification protection is not enabled.
  • consoleProtection: Modification protection is enabled to avoid that resources are modified by accident on the console.

protection_reason

No

String

Specifies the reason to enable modification protection. This parameter is valid only when protection_status is set to consoleProtection.

Response

Table 4 Parameter description

Parameter

Type

Description

loadbalancer

Loadbalancer object

Specifies the load balancer. For details, see Table 5.

Table 5 loadbalancer parameter description

Parameter

Type

Description

id

String

Specifies the load balancer ID.

tenant_id

String

Specifies the tenant ID.

name

String

Specifies the load balancer name.

The value contains a maximum of 255 characters.

description

String

Provides supplementary information about the load balancer.

The value contains a maximum of 255 characters.

vip_subnet_id

String

Specifies the ID of the IPv4 subnet where the load balancer works.

vip_port_id

String

Specifies the ID of the port bound to the private IP address of the load balancer.

provider

String

Specifies the provider of the load balancer.

vip_address

String

Specifies the private IP address of the load balancer.

The value contains a maximum of 64 characters.

listeners

Array of Listeners objects

Lists the IDs of listeners added to the load balancer. For details, see Table 6.

pools

Array of Pools objects

Lists the IDs of backend server groups associated with the load balancer. For details, see Table 7.

operating_status

String

Specifies the operating status of the load balancer. The value can be ONLINE or FROZEN.

provisioning_status

String

This parameter is reserved, and its value can only be ACTIVE.

It specifies the provisioning status of the load balancer.

admin_state_up

Boolean

Specifies the administrative status of the load balancer.

This parameter is reserved. The value can be true or false.

  • true: Enabled
  • false: Disabled

tags

Array

Lists load balancer tags.

created_at

String

Specifies the time when the load balancer was created.

The UTC time is in YYYY-MM-DDTHH:MM:SS format.

The value contains a maximum of 19 characters.

updated_at

String

Specifies the time when the load balancer was updated.

The UTC time is in YYYY-MM-DDTHH:MM:SS format.

The value contains a maximum of 19 characters.

enterprise_project_id

String

Specifies the enterprise project ID. When creating a load balancer, you can assign an enterprise project to the load balancer.

The value is character string 0 or a UUID with hyphens (-). Value 0 indicates the default enterprise project.

charge_mode

String

Specifies how the load balancer will be billed. The value can be one of the following:

  • flavor: indicates the guaranteed performance that allows the load balancer to handle up to 50,000 concurrent connections, 5,000 connections and 5,000 queries per second. You will be charged if the load balancer provides guaranteed performance.
  • null: indicates that guaranteed performance is not provided.

billing_info

String

Specifies whether the billing information is left blank.

protection_status

String

Specifies whether modification protection for resources is enabled. The value can be one of the following:

  • nonProtection (default) : Modification protection is not enabled.
  • consoleProtection: Modification protection is enabled to avoid that resources are modified by accident on the console.

protection_reason

String

Specifies the reason to enable modification protection. This parameter is valid only when protection_status is set to consoleProtection.

publicips

Array of PublicIpInfo objects

Specifies the EIP bound to the load balancer. Only one EIP can be bound to a load balancer.

Table 6 listeners parameter description

Parameter

Type

Description

id

String

Specifies the ID of the associated listener.

Table 7 pools parameter description

Parameter

Type

Description

id

String

Specifies the ID of the associated backend server group.

Table 8 PublicIpInfo

Parameter

Type

Description

publicip_id

String

Specifies the EIP ID.

publicip_address

String

Specifies the public IP address.

ip_version

Integer

Specifies the IP version. The value can be 4 (IPv4) or 6 (IPv6).

Example Request

  • Example request 1: Creating a private network load balancer
    POST https://{Endpoint}/v2/1867112d054b427e808cc6096d8193a1/elb/loadbalancers
    
    {
        "loadbalancer": {
            "name": "loadbalancer1",
            "description": "simple lb",
            "tenant_id": "1867112d054b427e808cc6096d8193a1",
            "vip_subnet_id": "58077bdb-d470-424b-8c45-2e3c65060a5b",
            "vip_address": "10.0.0.4",
            "admin_state_up": true,
            "enterprise_project_id": "0aad99bc-f5f6-4f78-8404-c598d76b0ed2" 
        }
    }

Example Response

  • Example response 1
    {
        "loadbalancer": {
            "description": "",
            "admin_state_up": true,
            "tenant_id": "1867112d054b427e808cc6096d8193a1",
     
            "provisioning_status": "ACTIVE",
            "vip_subnet_id": "58077bdb-d470-424b-8c45-2e3c65060a5b",
            "listeners": [],
            "vip_address": "10.0.0.4",
            "vip_port_id": "519f6af5-74aa-4347-9dba-84c440192877",
            "provider": "vlb",
            "pools": [],
            "tags": [],
            "id": "b0657373-0c68-41d1-980f-1a44d9e3ff01",
            "operating_status": "ONLINE",
            "name": "loadbalancer1",
            "created_at": "2018-07-25T01:54:13", 
            "updated_at": "2018-07-25T01:54:14",
            "enterprise_project_id": "0aad99bc-f5f6-4f78-8404-c598d76b0ed2" 
        }
    }

Status Code

For details, see Status Codes.