Creating a Load Balancer
Function
This API is used to create a dedicated load balancer. When you create a dedicated load balancer, note the following:
-
Specify vip_subnet_cidr_id if you want to bind a private IPv4 address to the dedicated load balancer.
-
Specify publicip and either vpc_id or vip_subnet_cidr_id if you want to bind a new IPv4 EIP to the dedicated load balancer.
-
Specify publicip_ids and either vpc_id or vip_subnet_cidr_id if you want to bind an existing IPv4 EIP to the dedicated load balancer.
-
Specify ipv6_vip_virsubnet_id if you want to bind a private IPv6 address to the dedicated load balancer.
-
Specify both ipv6_vip_virsubnet_id and ipv6_bandwidth if you want to bind a public IPv6 address to the dedicated load balancer.
-
Specify l4_flavor_id if you want to create a network load balancer and l7_flavor_id to create an application load balancer. Specify both l4_flavor_id and l7_flavor_id if you want to create a load balancer that can work at both Layer 4 and Layer 7.
-
Specify prepaid_options if you want to create a yearly/monthly load balancer.
-
If prepaid_options is not specified, pay-per-use load balancers will be created, which are billed by fixed specifications or elastic specifications you have selected for l4_flavor_id and l7_flavor_id when creating the load balancer.
-
Set loadbalancer_type to gateway if you want to create a gateway load balancer. vip_address and ipv6_vip_address are not supported by gateway load balancers. vip_subnet_cidr_id and ipv6_subnet_cidr_id cannot be left blank at the same time, You cannot bind an EIP to gateway load balancers. Specify gw_flavor_id if you need a given flavor.
Constraints
There are some constraints when you create a dedicated load balancer:
-
vpc_id, vip_subnet_cidr_id, and ipv6_vip_virsubnet_id cannot be left blank at the same time.
-
ip_target_enable specifies whether to enable IP as a Backend. If you enable this function for a dedicated load balancer, you can associate servers in a VPC connected through a VPC peering connection, in a VPC connected through a cloud connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using server IP addresses.
-
admin_state_up must be set to true.
-
provider must be set to vlb.
-
elb_virsubnet_ids indicates the subnets that support IPv4/IPv6 dual stack or only IPv4 subnets. If only IPv4 subnets are supported, ipv6_vip_virsubnet_id must be left blank.
-
If you bind an EIP to the load balancer during creation, you cannot unbind it from the load balancer by calling the API after the load balancer is created. Instead, you can unbind the EIP only on the ELB console. Locate the dedicated load balancer in the load balancer list and click More > Unbind EIP in the Operation column.
-
publicip_ids and publicip cannot be specified at the same time. Set either publicip_ids to bind an existing EIP to the load balancer, or publicip to bind a new EIP to the load balancer, or neither of them.
-
If you want to add the load balancer to a shared bandwidth, you must specify the ID of the shared bandwidth. If you want the load balancer to use a new dedicated bandwidth, charge_mode, share_type, and size are required.
Calling Method
For details, see Calling APIs.
URI
POST /v3/{project_id}/elb/loadbalancers
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID of the load balancer. Minimum: 0 Maximum: 36 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Specifies the token used for IAM authentication. Minimum: 0 Maximum: 4096 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
loadbalancer |
Yes |
CreateLoadBalancerOption object |
Specifies the load balancer. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
No |
String |
Specifies the project ID. Minimum: 1 Maximum: 32 |
name |
No |
String |
Specifies the load balancer name. Minimum: 0 Maximum: 255 |
description |
No |
String |
Provides supplementary information about the load balancer. Minimum: 0 Maximum: 255 |
vip_address |
No |
String |
Specifies the private IPv4 address bound to the load balancer. The IP address must be from the IPv4 subnet where the load balancer resides and should not be occupied by other services. Note:
The IP address must be in [0-255].[0-255].[0-255].[0-255] format, for example, 192.168.1.1. |
vip_subnet_cidr_id |
No |
String |
Specifies the ID of the frontend IPv4 subnet where the load balancer resides. You can query parameter neutron_subnet_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets). Note:
The ID must be in UUID format and can contain up to 36 characters. Minimum: 1 Maximum: 36 |
ipv6_vip_virsubnet_id |
No |
String |
Specifies the ID of the frontend IPv6 subnet where the load balancer resides. You can query parameter neutron_network_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets). Note:
The ID must be in UUID format and can contain up to 36 characters. |
provider |
No |
String |
Specifies the provider of the load balancer. The value can only be vlb. Minimum: 1 Maximum: 255 |
l4_flavor_id |
No |
String |
Specifies the flavor ID of a network load balancer. You can query parameter id in the response by calling the API (GET https://{ELB_Endpoint}/v3/{project_id}/elb/flavors?type=L4). Note:
The ID must be in UUID format and can contain up to 36 characters. Minimum: 1 Maximum: 36 |
l7_flavor_id |
No |
String |
Specifies the flavor ID of an applicaiton load balancer. You can query parameter id in the response by calling the API (GET https://{ELB_Endpoint}/v3/{project_id}/elb/flavors?type=L7). Note:
The ID must be in UUID format and can contain up to 36 characters. Minimum: 1 Maximum: 36 |
gw_flavor_id |
No |
String |
Specifies the flavor ID of the gateway load balancer. If gw_flavor_id is not specified, the default flavor is used. The default flavor varies by site. Minimum: 1 Maximum: 36 |
guaranteed |
No |
Boolean |
Specifies whether the load balancer is a dedicated load balancer.
Currently, the value can only be true. If the value is set to false, 400 Bad Request will be returned. |
loadbalancer_type |
No |
String |
Specifies the load balancer type.The type can be:
|
vpc_id |
No |
String |
Specifies the ID of the VPC where the load balancer resides. You can query parameter id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/vpcs). vpc_id, vip_subnet_cidr_id, and ipv6_vip_virsubnet_id cannot be left blank at the same time. The subnet specified by vip_subnet_cidr_id and the subnet specified by ipv6_vip_virsubnet_id must be in the VPC specified by vpc_id. The ID must be in UUID format and can contain up to 36 characters. |
availability_zone_list |
Yes |
Array of strings |
Specifies the list of AZs where the load balancer can be created. You can query the AZs by calling the API (GET https://{ELB_Endpoint}/v3/{project_id}/elb/availability-zones). Select one or more AZs in the same set. |
enterprise_project_id |
No |
String |
Specifies the ID of the enterprise project that the load balancer belongs to. The value cannot be "", "0", or the ID of an enterprise project that does not exist. If this parameter is not passed during resource creation, the resource belongs to the default enterprise project, and 0 will be returned. |
tags |
No |
Array of Tag objects |
Lists the tags added to the load balancer. Example: "tags":[{"key":"my_tag","value":"my_tag_value"}] |
admin_state_up |
No |
Boolean |
Specifies whether to enable the load balancer.
The value must be in the Boolean type. |
ipv6_bandwidth |
No |
BandwidthRef object |
Specifies the ID of the bandwidth used by an IPv6 address. This parameter is available only when you create or update a load balancer with a public IPv6 address. If you use a new IPv6 address and specify a shared bandwidth, the IPv6 address will be added to the shared bandwidth. |
publicip_ids |
No |
Array of strings |
Specifies the ID of the EIP the system will automatically assign and bind to the load balancer during load balancer creation. Only the first EIP will be bound to the load balancer although multiple EIP IDs can be set. This parameter is not supported by gateway load balancers. |
publicip |
No |
Specifies the new EIP that will be bound to the load balancer. |
|
elb_virsubnet_ids |
No |
Array of strings |
Specifies the IDs of subnets on the downstream plane. You can query parameter neutron_network_id in the response by calling the API (GET https://{VPC_Endpoint}/v1/{project_id}/subnets). If this parameter is not specified, select subnets as follows:
If there is more than one subnet, the first subnet in the list will be used. Note:
|
ip_target_enable |
No |
Boolean |
Specifies whether to add backend servers that are not in the load balancer's VPC. If you enable this function, you can add servers in a peer VPC connected through a VPC peering connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using their IP addresses. This parameter is not supported by gateway load balancers. The value can be true (IP as a Backend enabled) or false (IP as a Backend disabled). Note:
|
deletion_protection_enable |
No |
Boolean |
Specifies whether to enable deletion protection for the load balancer.
NOTE:
Disable deletion protection before deleting your resources. |
autoscaling |
No |
Specifies the information about elastic scaling. If elastic scaling is enabled, the load balancer specifications can be automatically adjusted based on incoming traffic. Note:
This parameter is unsupported. Please do not use it. |
|
ipv6_vip_address |
No |
String |
Specifies the IPv6 address bound to the load balancer. Constraints:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
No |
String |
Specifies the tag key. Minimum: 1 Maximum: 36 |
value |
No |
String |
Specifies the tag value. Minimum: 0 Maximum: 43 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Specifies the shared bandwidth ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
ip_version |
No |
Integer |
Specifies the IP address version. The value can be 4 (IPv4) or 6 (IPv6). The default value is 4. Default: 4 |
network_type |
Yes |
String |
Specifies the EIP type. The default value is 5_bgp. For more information, see the API for assigning an EIP in the Virtual Private Cloud API Reference. Minimum: 1 Maximum: 36 |
billing_info |
No |
String |
Provides billing information about the EIP. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 1024 |
description |
No |
String |
Provides supplementary information about the EIP. Minimum: 1 Maximum: 255 |
bandwidth |
Yes |
Provides supplementary information about the bandwidth. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
No |
String |
Specifies the bandwidth name. The value can contain 1 to 64 characters, including letters, digits, underscores (_), hyphens (-), and periods. Note:
Minimum: 1 Maximum: 64 |
size |
No |
Integer |
Specifies the bandwidth range. The default range is 1 Mbit/s to 2,000 Mbit/s. (The specific range may vary depending on the configuration in each region. You can see the available bandwidth range on the management console.) Note: The minimum increment for bandwidth adjustment varies depending on the bandwidth range. The following are the details:
This parameter is mandatory if id is set to null. Minimum: 0 Maximum: 99999 |
charge_mode |
No |
String |
Specifies how the bandwidth used by the EIP is billed. Currently, the bandwidth can be billed only by traffic. This parameter is mandatory if id is set to null. Minimum: 1 Maximum: 36 |
share_type |
No |
String |
Specifies the bandwidth type.
Note:
|
billing_info |
No |
String |
Specifies bandwidth billing information. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 1024 |
id |
No |
String |
Specifies the ID of the shared bandwidth to which the IP address bound to the load balancer is added. Note:
Minimum: 1 Maximum: 36 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enable |
Yes |
Boolean |
Specifies whether to enable elastic scaling for the load balancer. This parameter is not supported by gateway load balancers. Please do not use it. The value can be true (elastic scaling enabled) or false (elastic scaling disabled). Default: false |
min_l7_flavor_id |
No |
String |
Specifies the ID of the minimum Layer-7 flavor for elastic scaling. This parameter cannot be left blank if there are HTTP or HTTPS listeners. Minimum: 1 Maximum: 36 |
Response Parameters
Status code: 201
Parameter |
Type |
Description |
---|---|---|
loadbalancer |
LoadBalancer object |
Specifies the load balancer. |
loadbalancer_id |
String |
Specifies the load balancer ID. This parameter is unsupported. Please do not use it. Minimum: 0 Maximum: 36 |
order_id |
String |
Specifies the order No. This parameter is unsupported. Please do not use it. Minimum: 0 Maximum: 36 |
request_id |
String |
Specifies the request ID. The value is automatically generated. Minimum: 0 Maximum: 36 |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Specifies the load balancer ID. |
description |
String |
Provides supplementary information about the load balancer. Minimum: 1 Maximum: 255 |
provisioning_status |
String |
Specifies the provisioning status of the load balancer. The value can be one of the following:
|
admin_state_up |
Boolean |
Specifies the administrative status of the load balancer. The value can be true or false. true indicates the load balancer is enabled and false indicates the load balancer is disabled. |
provider |
String |
Specifies the provider of the load balancer. The value can only be vlb. |
pools |
Array of PoolRef objects |
Lists the IDs of backend server groups associated with the load balancer. |
listeners |
Array of ListenerRef objects |
Lists the IDs of listeners added to the load balancer. |
operating_status |
String |
Specifies the operating status of the load balancer. The value can only be ONLINE, indicating that the load balancer is running normally. |
name |
String |
Specifies the load balancer name. |
project_id |
String |
Specifies the project ID of the load balancer. |
vip_subnet_cidr_id |
String |
Specifies the ID of the IPv4 subnet where the load balancer resides. |
vip_address |
String |
Specifies the private IPv4 address bound to the load balancer. |
vip_port_id |
String |
Specifies the ID of the port bound to the private IPv4 address of the load balancer. |
tags |
Array of Tag objects |
Lists the tags added to the load balancer. |
created_at |
String |
Specifies the time when the load balancer was created, in the format of yyyy-MM-dd''T''HH:mm:ss''Z''. |
updated_at |
String |
Specifies the time when the load balancer was updated, in the format of yyyy-MM-dd''T''HH:mm:ss''Z''. |
guaranteed |
Boolean |
Specifies whether the load balancer is a dedicated load balancer.
|
vpc_id |
String |
Specifies the ID of the VPC where the load balancer resides. |
eips |
Array of EipInfo objects |
Specifies the EIP bound to the load balancer. Only one EIP can be bound to a load balancer. This parameter has the same meaning as publicips. |
ipv6_vip_address |
String |
Specifies the IPv6 address bound to the load balancer. |
ipv6_vip_virsubnet_id |
String |
Specifies the ID of the IPv6 subnet where the load balancer resides. |
ipv6_vip_port_id |
String |
Specifies the ID of the port bound to the IPv6 address of the load balancer. |
availability_zone_list |
Array of strings |
Specifies the list of AZs where the load balancer is created. |
enterprise_project_id |
String |
Specifies the enterprise project ID. If this parameter is not passed during resource creation, "0" will be returned, and the resource belongs to the default enterprise project. "0" is not a valid enterprise project ID and cannot be used in the APIs for creating, updating the load balancer, or querying details of the load balancer. |
billing_info |
String |
Provides resource billing information. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 1024 |
l4_flavor_id |
String |
Specifies the ID of a flavor at Layer 4. Minimum: 1 Maximum: 255 |
l4_scale_flavor_id |
String |
Specifies the ID of the reserved flavor at Layer 4. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 255 |
l7_flavor_id |
String |
Specifies the ID of a flavor at Layer 7. Minimum: 1 Maximum: 255 |
l7_scale_flavor_id |
String |
Specifies the ID of the reserved flavor at Layer 7. This parameter is unsupported. Please do not use it. Minimum: 1 Maximum: 255 |
publicips |
Array of PublicIpInfo objects |
Specifies the EIP bound to the load balancer. Only one EIP can be bound to a load balancer. This parameter has the same meaning as eips. |
global_eips |
Array of GlobalEipInfo objects |
Specifies the global EIP bound to the load balancer. Only the first global EIP specified under global_eips will be bound. This parameter is unsupported. Please do not use it. |
elb_virsubnet_ids |
Array of strings |
Lists the IDs of subnets on the downstream plane. |
elb_virsubnet_type |
String |
Specifies the type of the subnet on the downstream plane.
|
ip_target_enable |
Boolean |
Specifies whether to enable the IP as a Backend option. If you enable this function, you can add servers in a peer VPC connected through a VPC peering connection, or in an on-premises data center at the other end of a Direct Connect or VPN connection, by using their IP addresses. The value can be true (enable IP as a Backend) or false (disable IP as a Backend). Note:
|
frozen_scene |
String |
Specifies the scenario where the load balancer is frozen. Multiple values are separated using commas (,). This parameter is unsupported. Please do not use it. |
ipv6_bandwidth |
BandwidthRef object |
Specifies the ID of the bandwidth used by an IPv6 address. This parameter is available only when you create or update a load balancer with a public IPv6 address. If you use a new IPv6 address and specify a shared bandwidth, the IPv6 address will be added to the shared bandwidth. |
deletion_protection_enable |
Boolean |
Specifies whether deletion protection is enabled.
NOTE:
Disable deletion protection for all your resources before deleting your account. This parameter is returned only when deletion protection is enabled at the site. This parameter is unsupported. Please do not use it. |
autoscaling |
AutoscalingRef object |
Specifies information about elastic scaling. If elastic scaling is enabled, the load balancer specifications can be automatically adjusted based on incoming traffic. Note:
This parameter is unsupported. Please do not use it. |
public_border_group |
String |
Specifies the AZ group to which the load balancer belongs. |
waf_failure_action |
String |
Specifies traffic distributing policies when the WAF is faulty.
Note: This parameter takes effect only when WAF is enabled for the load balancer. This parameter is unsupported. Please do not use it. |
log_group_id |
String |
Specifies the ID of the log group that is associated with the load balancer. |
log_topic_id |
String |
Specifies the ID of the log topic that is associated with the load balancer. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key. Minimum: 1 Maximum: 36 |
value |
String |
Specifies the tag value. Minimum: 0 Maximum: 43 |
Parameter |
Type |
Description |
---|---|---|
eip_id |
String |
eip_id |
eip_address |
String |
eip_address |
ip_version |
Integer |
Specifies the IP version. 4 indicates IPv4, and 6 indicates IPv6. |
Parameter |
Type |
Description |
---|---|---|
publicip_id |
String |
Specifies the EIP ID. |
publicip_address |
String |
Specifies the IP address. |
ip_version |
Integer |
Specifies the IP version. The value can be 4 (IPv4) or 6 (IPv6). |
Parameter |
Type |
Description |
---|---|---|
global_eip_id |
String |
Specifies the ID of the global EIP. |
global_eip_address |
String |
Specifies the global EIP. |
ip_version |
Integer |
Specifies the IP version. The value can be 4 and 6. 4 indicates an IPv4 address, and 6 indicates an IPv6 address. |
Parameter |
Type |
Description |
---|---|---|
enable |
Boolean |
Specifies whether to enable elastic scaling for the load balancer.
|
min_l7_flavor_id |
String |
Specifies the ID of the minimum Layer-7 flavor for elastic scaling. This parameter cannot be left blank if there are HTTP or HTTPS listeners. Minimum: 1 Maximum: 36 |
Example Requests
-
Example 1: Creating a load balancer with a private IPv4 address
POST https://{ELB_Endponit}/v3/060576798a80d5762fafc01a9b5eedc7/elb/loadbalancers { "loadbalancer" : { "name" : "loadbalancer", "description" : "simple lb", "vip_subnet_cidr_id" : "1992ec06-f364-4ae3-b936-6a8cc24633b7", "admin_state_up" : true, "availability_zone_list" : [ "AZ1" ] } }
-
Example 2: Creating a load balancer with an IPv4 EIP
POST https://{ELB_Endponit}/v3/060576782980d5762f9ec014dd2f1148/elb/loadbalancers { "loadbalancer" : { "vip_subnet_cidr_id" : "e6e9271d-aef4-48f0-a93a-ccc7b09032c1", "availability_zone_list" : [ "AZ1" ], "admin_state_up" : true, "publicip" : { "network_type" : "5_bgp", "bandwidth" : { "size" : 2, "share_type" : "PER", "charge_mode" : "bandwidth", "name" : "bandwidth_test" } }, "name" : "elb_eip-test" } }
-
Example 3: Creating a gateway load balancer
POST https://{ELB_Endponit}/v3/060576798a80d5762fafc01a9b5eedc7/elb/loadbalancers { "loadbalancer" : { "name" : "loadbalancer", "description" : "simple gateway lb", "loadbalancer_type" : "gateway", "gw_flavor_id" : "2e859438-7cbb-417b-8f3b-5f618ca76a52", "vip_subnet_cidr_id" : "1992ec06-f364-4ae3-b936-6a8cc24633b7", "ipv6_vip_virsubnet_id" : "8e7aac33-0d87-4cb2-9cce-2856615d607f", "admin_state_up" : true, "availability_zone_list" : [ "AZ1" ] } }
Example Responses
Status code: 201
Normal response to POST requests.
{ "loadbalancer" : { "name" : "my_loadbalancer", "id" : "29cc669b-3ac8-4498-9094-bdf6193425c2", "project_id" : "060576798a80d5762fafc01a9b5eedc7", "description" : "", "vip_port_id" : "98697944-0cc7-4d3b-a829-001c2fb82232", "vip_address" : "192.168.0.214", "admin_state_up" : true, "provisioning_status" : "ACTIVE", "operating_status" : "ONLINE", "listeners" : [ ], "pools" : [ ], "tags" : [ { "key" : "tab_key", "value" : "tag1" } ], "provider" : "vlb", "created_at" : "2023-03-22T07:59:57Z", "updated_at" : "2023-03-22T07:59:59Z", "vpc_id" : "a1f33a4c-95b9-48a7-9350-684e2ed844b3", "enterprise_project_id" : "134f2181-5720-47e7-bd78-1356ed3737d6", "availability_zone_list" : [ ], "ipv6_vip_address" : null, "ipv6_vip_virsubnet_id" : null, "ipv6_vip_port_id" : null, "publicips" : [ { "publicip_id" : "3388574a-4f6f-4471-869e-97d74d21eee9", "publicip_address" : "88.88.87.205", "ip_version" : 4 } ], "global_eips" : [ ], "elb_virsubnet_ids" : [ ], "elb_virsubnet_type" : null, "ip_target_enable" : false, "autoscaling" : { "enable" : false, "min_l7_flavor_id" : "" }, "frozen_scene" : null, "public_border_group" : "center", "eips" : [ { "eip_id" : "3388574a-4f6f-4471-869e-97d74d21eee9", "eip_address" : "88.88.87.205", "ip_version" : 4 } ], "guaranteed" : false, "billing_info" : null, "l4_flavor_id" : null, "l4_scale_flavor_id" : null, "l7_flavor_id" : null, "l7_scale_flavor_id" : null, "waf_failure_action" : "", "vip_subnet_cidr_id" : "abf31f3b-706e-4e55-a6dc-f2fcc707fd3a" }, "request_id" : "bf29597181cb81b30d19f1a0115a157d" }
Status Codes
Status Code |
Description |
---|---|
201 |
Normal response to POST requests. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.