Skip to main content

Create Load Balancer

POST/v2/lbaas/loadbalancers

Creates a load balancer, and optionally its listener, pool, health monitor, and members in the same request. The load balancer is provisioned asynchronously: it returns PENDING_CREATE and becomes usable when its status reaches ACTIVE.

Request​

Parameters​

loadbalancerobjectrequired

Load balancer wrapper.

12 fields
namestringbody

Human-readable name.

descriptionstringbody

Free-form description.

vip_subnet_idstringbody

Subnet for the VIP. One of vip_subnet_id, vip_network_id, or vip_port_id is required.

vip_network_idstringbody

Network for the VIP. One of the three VIP fields is required.

vip_port_idstringbody

Existing port for the VIP. One of the three VIP fields is required.

vip_addressstringbody

Specific IP address for the VIP.

vip_ip_versionintegerbody

4 or 6. Default: 4.

2 values
  • 4 IPv4 VIP.
  • 6 IPv6 VIP.
providerstringbody

Provider driver. Default: octavia.

flavor_idstringbody

Load balancer flavor ID, if your project has one.

admin_state_upbooleanbody

Administrative state. Default: true.

tagsarraybody

Tags on the resource.

listenersarraybody

Listeners to create with the load balancer.

4 fields
namestringbody

Listener name.

protocolstringrequiredbody

HTTP, HTTPS, TCP, UDP, and similar.

4 values
  • HTTP HTTP traffic.
  • HTTPS HTTP over TLS.
  • TCP TCP passthrough, without inspecting the payload.
  • UDP UDP datagrams.
protocol_portintegerrequiredbody

Port the listener accepts traffic on.

default_poolobjectbody

Pool to create and bind as the listener default pool.

5 fields
namestringbody

Pool name.

protocolstringrequiredbody

Pool protocol, for example HTTP.

4 values
  • HTTP Pool members speak HTTP.
  • HTTPS Pool members speak HTTPS.
  • TCP TCP passthrough to members.
  • UDP UDP to members.
lb_algorithmstringbody

ROUND_ROBIN, LEAST_CONNECTIONS, or SOURCE_IP.

3 values
  • ROUND_ROBIN Distributes new connections evenly across members.
  • LEAST_CONNECTIONS Sends new connections to the member with the fewest active connections.
  • SOURCE_IP Hashes the source address to pick a member, so a client sticks to the same member.
healthmonitorobjectbody

Health monitor for the pool.

4 fields
typestringrequiredbody

HTTP, HTTPS, TCP, PING, and similar.

4 values
  • HTTP Sends an HTTP request and expects a successful response.
  • HTTPS Sends an HTTPS request and expects a successful response.
  • TCP Checks that the member accepts a TCP connection.
  • PING Sends ICMP echo requests.
delayintegerrequiredbody

Seconds between checks.

timeoutintegerrequiredbody

Seconds before a check times out.

max_retriesintegerrequiredbody

Failed checks before a member is marked down.

membersarraybody

Backend members.

2 fields
addressstringrequiredbody

Member IP address.

protocol_portintegerrequiredbody

Member port.

Sample Request​

curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d '{
"loadbalancer": {
"name": "lb2",
"vip_subnet_id": "fd2de462-f93b-43a6-9b5c-254f1e690bf1",
"listeners": [
{
"name": "http_listener",
"protocol": "HTTP",
"protocol_port": 80,
"default_pool": {
"name": "rr_pool",
"protocol": "HTTP",
"lb_algorithm": "ROUND_ROBIN",
"healthmonitor": {
"type": "HTTP",
"delay": 3,
"timeout": 1,
"max_retries": 2
},
"members": [
{"address": "192.168.10.245", "protocol_port": 80},
{"address": "192.168.10.168", "protocol_port": 80}
]
}
}
]
}
}' https://api.vietnix.cloud:9888/v2/lbaas/loadbalancers

Response​

Sample Response​

Response body
{
"loadbalancer": {
"id": "3f2a1b9c-6d4e-4f70-8a11-2c3d4e5f6a70",
"name": "lb2",
"provisioning_status": "PENDING_CREATE",
"operating_status": "OFFLINE",
"provider": "amphora",
"vip_address": "192.168.10.5",
"vip_subnet_id": "fd2de462-f93b-43a6-9b5c-254f1e690bf1",
"vip_network_id": "15f7dc0a-712c-422f-bfd3-31dc351d9026",
"vip_port_id": "fb0e8e3e-2a71-420a-885c-94f6d2c2f2b7",
"listeners": [
{"id": "1dc8539c-7545-4ae8-8081-3140a47b6342"}
],
"pools": [
{"id": "bd04cc50-0575-45cc-a965-514357a4b62d"}
],
"admin_state_up": true,
"tags": []
}
}

Status Code​

Success​

Status CodeDescription
201 - CreatedThe load balancer was created and provisioning started.

Error​

Status CodeDescription
400 - Bad RequestSome content in the request was invalid, for example no VIP field.
401 - UnauthorizedUser must authenticate before making a request.
403 - ForbiddenPolicy does not allow current user to do this operation.
404 - Not FoundThe subnet, network, or port does not exist.
500 - Internal Server ErrorThe service failed to process the request.
503 - Service UnavailableThe load balancing service is not available.
note

The VIP is a private address. To publish the service, create a floating IP and associate it with vip_port_id (see Update Floating IP).