CreateLoadBalancer
1. API Description
This API is used to create a load balancing instance.
Prerequisites
Query the available zones for creating load balancers: call the DescribeLoadBalancerZones.
Query whether the load balancing IP can be created in a zone: call the DescribeLoadBalancerIPv4 or DescribeLoadBalancerIPv6.
Query whether the load balancing specifications can be created in a zone: call the DescribeLoadBalancerSpecs.
Cost estimation: to know of load balancer pricing, see Pricing for more details.
2. Input Parameters
The following request parameter list only provides API request parameters.
clientToken
No
String
Used to ensure the idempotency of the request.
zoneId
Yes
String
The zone ID.
loadBalancerName
Yes
String
The name of the load balancer.
specName
Yes
String
Specifications.
chargeType
Yes
String
Pricing model.
PREPAID
: subscription;
POSTPAID
: pay-as-you-go.
instanceChargePrepaid
No
Subscription mode. Details of the monthly or yearly subscription configurations, including the subscription period, auto-renewal, etc.
It is required if the pricing model is PREPAID
.
bandwidth
Yes
Integer
Bandwidth value.
Value range: [1,1024
].
Unit: Mbps
.
ipType
Yes
String
Specify the type of IP added to the load balancer. Available values:
IPv4
IPv6
vipCount
No
Integer
Number of additional VIPs to be purchased. The load balancer binds 1 IP of the specified type by default.
subnetId
No
String
Subnet ID. The subnet ID must be specified when creating a VIP4 type. The primary and secondary IPs of the instance will be obtained in the subnet.
cidrBlockId
No
String
CIDR block ID. The CIDR block ID needs to be specified when creating a VIP6 type. If there is only one CIDR block in the zone, it can be unspecified and the CIDR will be used by default.
masterIp
No
String
Primary IP.
backupIp
No
String
Secondary IP.
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request. RequestId is required for locating a problem.
orderNumber
String
Order number.
loadBalancerId
String
Load balancer ID.
4. Code Example
Create a load balancing instance.
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateLoadBalancer
<Common Request Params>
Request:
{
"zoneId": "HKG-A",
"loadBalancerName": "xxxx",
"specName": "xxxx",
"clientToken": "xxxx",
"chargeType": "xxxx",
"bandwidth": 100,
"subnetId": "xxxx",
"ipType": "IPv4"
}
Response:
{
"requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
"response": {
"requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
"orderNumber": "xxxx",
"loadBalancerId": "xxxx"
}
}
5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
No error codes related to the API business logic. For other error codes, see Common Error Codes.
Last updated