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.
POST /v2.0/lbaas/loadbalancers
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
loadbalancer |
Yes |
Object |
Specifies the load balancer. For details, see Table 2. |
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 subnet where the load balancer works. You can obtain the value by calling the API for querying subnets {VPC endpoint}/v2.0/subnets} using the GET method. The private IP address of the load balancer is in this subnet. Only IPv4 subnets are supported. IPv6 subnets are not 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. The default value is true. |
Parameter |
Type |
Description |
---|---|---|
loadbalancer |
Object |
Specifies the load balancer. For details, see Table 4. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the load balancer ID. |
tenant_id |
String |
Specifies the ID of the project where the load balancer is used. The value contains a maximum of 255 characters. |
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 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. When you create a load balancer, the system automatically creates a port and associates it with a security group. However, the security group will not take effect. |
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 |
Lists the IDs of listeners added to the load balancer. For details, see Table 5. |
pools |
Array |
Lists the IDs of backend server groups associated with the load balancer. For details, see Table 6. |
operating_status |
String |
This parameter is reserved, and its value can only be ONLINE. It specifies the operating status of the load balancer. |
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.
|
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. |
POST https://{Endpoint}/v2.0/lbaas/loadbalancers { "loadbalancer": { "name": "loadbalancer1", "description": "simple lb", "tenant_id": "1867112d054b427e808cc6096d8193a1", "vip_subnet_id": "58077bdb-d470-424b-8c45-2e3c65060a5b", "vip_address": "192.168.0.100", "admin_state_up": true } }
(Bind an EIP to the port that has been bound to the load balancer's private IP address. For details about the parameters, see Table 7.)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
publicip |
Yes |
Object |
Specifies the EIP. For details, see Table 8. |
bandwidth |
Yes |
Object |
Specifies the bandwidth. For details, see Table 9. |
enterprise_project_id |
No |
String |
NOTE:
For more information about enterprise projects and how to obtain enterprise project IDs, see the Enterprise Management User Guide. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
|
ip_version |
No |
Integer |
|
ip_address |
No |
String |
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
|
size |
Yes |
Integer |
|
id |
No |
String |
|
share_type |
Yes |
String |
|
charge_mode |
No |
String |
|
POST https://{VPCEndpoint}/v1/8b7e35ad379141fc9df3e178bd64f55c/publicips { "publicip": { "type": "5_bgp", "ip_version": 4 }, "bandwidth": { "name": "bandwidth123", "size": 10, "share_type": "PER" } }
{ "publicip": { "id": "f588ccfa-8750-4d7c-bf5d-2ede24414706", "status": "PENDING_CREATE", "type": "5_bgp", "public_ip_address": "139.9.204.183", "tenant_id": "8b7e35ad379141fc9df3e178bd64f55c", "ip_version": 4, "create_time": "2019-06-29 06:45:32", "bandwidth_size": 1 } }
PUT /v1/8b7e35ad379141fc9df3e178bd64f55c/publicips/f588ccfa-8750-4d7c-bf5d-2ede24414706 { "publicip": { "port_id": "a7ecbdb5-5a63-41dd-a830-e16c0a7e04a7" } }
{ "publicip": { "id": "f588ccfa-8750-4d7c-bf5d-2ede24414706", "status": "ACTIVE", "type": "5_bgp", "port_id": "a7ecbdb5-5a63-41dd-a830-e16c0a7e04a7", "public_ip_address": "139.9.204.183", "private_ip_address": "192.168.1.131", "tenant_id": "8b7e35ad379141fc9df3e178bd64f55c", "create_time": "2019-06-29 07:33:18", "bandwidth_size": 1, "ip_version": 4 } }
{ "loadbalancer": { "description": "simple lb", "provisioning_status": "ACTIVE", "tenant_id": "1867112d054b427e808cc6096d8193a1", "created_at": "2019-01-19T05:32:56", "admin_state_up": true, "updated_at": "2019-01-19T05:32:57", "id": "ea2843da-4026-49ec-8338-8fa015b067fc", "pools": [], "listeners": [], "vip_port_id": "a7ecbdb5-5a63-41dd-a830-e16c0a7e04a7", "operating_status": "ONLINE", "vip_address": "192.168.0.100", "vip_subnet_id": "58077bdb-d470-424b-8c45-2e3c65060a5b", "provider": "vlb", "tags": [], "name": "loadbalancer1" } }
POST https://{Endpoint}/v2.0/lbaas/loadbalancers { "loadbalancer": { "name": "loadbalancer1", "description": "simple lb", "tenant_id": "1867112d054b427e808cc6096d8193a1", "vip_subnet_id": "58077bdb-d470-424b-8c45-2e3c65060a5b", "vip_address": "192.168.0.100", "admin_state_up": true } }
After the preceding steps are complete, the load balancer has the capability of accessing the public network. You can access the load balancer using 139.9.204.183, the value of parameter public_ip_address.