Domain name for API request: teo.tencentcloudapi.com.
This API is used to create a LoadBalancer. For details, see Quickly Create Load Balancers. The load balancing feature is in beta test. If you need to use it, contact us.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: CreateLoadBalancer. |
Version | Yes | String | Common Params. The value used for this API: 2022-09-01. |
Region | No | String | Common Params. This parameter is not required. |
ZoneId | Yes | String | Zone ID. |
Name | Yes | String | LoadBalancer name, which can contain 1 to 200 characters, including a-z, A-Z, 0-9, underscores (_), and hyphens (-). |
Type | Yes | String | LoadBalancer type. Valid values: |
OriginGroups.N | Yes | Array of OriginGroupInLoadBalancer | List of origin server groups and their corresponding disaster recovery scheduling priorities. For details, refer to Sample Scenario in Quickly Create Load Balancers. |
HealthChecker | No | HealthChecker | Health check policy. For details, refer to Health Check Policies. If left empty, health check is disabled by default. |
SteeringPolicy | No | String | Traffic scheduling policy among origin server groups. Valid values: |
FailoverPolicy | No | String | Request retry policy when access to an origin server fails. For details, refer to Introduction to Request Retry Strategy. Valid values: |
Parameter Name | Type | Description |
---|---|---|
InstanceId | String | CLB instance ID. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
This example shows you how to create a LoadBalancer by selecting ICMP Ping for a health check policy and OtherRecordInOriginGroup for a request retry policy.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lrnpaxol",
"Name": "ICMP-LB",
"Type": "HTTP",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2bse"
}
],
"HealthChecker": {
"Type": "ICMP Ping",
"Interval": 30,
"Timeout": 5,
"HealthThreshold": 3,
"CriticalThreshold": 2
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherRecordInOriginGroup"
}
{
"Response": {
"RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
"InstanceId": "lb-2osw7z07dnyu"
}
}
This example shows you how to create a LoadBalancer by selecting HTTPS for a health check policy and OtherRecordInOriginGroup for a request retry policy.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lrnpaxol",
"Name": "HTTPS-LB",
"Type": "GENERAL",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_3",
"OriginGroupId": "og-30l5kv5z2bse"
}
],
"HealthChecker": {
"Type": "HTTPS",
"Path": "www.example.com/test",
"Port": 80,
"Interval": 30,
"Method": "HEAD",
"ExpectedCodes": [
"200",
"500",
"501",
"502",
"503",
"504",
"505",
"507",
"520",
"521",
"525",
"530",
"544",
"562",
"567",
"599"
],
"FollowRedirect": "true",
"Headers": [
{
"Key": "header1",
"Value": "header1"
},
{
"Key": "header2",
"Value": "header2"
},
{
"Key": "header3",
"Value": "header3"
}
],
"Timeout": 5,
"HealthThreshold": 3,
"CriticalThreshold": 2
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherRecordInOriginGroup"
}
{
"Response": {
"RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
"InstanceId": "lb-2osw7z17dnyu"
}
}
This example shows you how to create a LoadBalancer by selecting HTTP for a health check policy and OtherRecordInOriginGroup for a request retry policy.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lrnpaxol",
"Name": "HTTP-LB",
"Type": "GENERAL",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_3",
"OriginGroupId": "og-30l5kv5z2bse"
}
],
"HealthChecker": {
"Type": "HTTP",
"Path": "www.example.com/test",
"Port": 80,
"Interval": 30,
"Method": "HEAD",
"ExpectedCodes": [
"200",
"500",
"501",
"502",
"503",
"504",
"505",
"507",
"520",
"521",
"525",
"530",
"544",
"562",
"567",
"599"
],
"FollowRedirect": "true",
"Headers": [
{
"Key": "header1",
"Value": "header1"
},
{
"Key": "header2",
"Value": "header2"
},
{
"Key": "header3",
"Value": "header3"
}
],
"Timeout": 5,
"HealthThreshold": 3,
"CriticalThreshold": 2
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherRecordInOriginGroup"
}
{
"Response": {
"RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
"InstanceId": "lb-2osw7z07dnyu"
}
}
This example shows you how to create a LoadBalancer by selecting TCP for a health check policy and OtherOriginGroup for a request retry policy.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lrnsaxol",
"Name": "TCP-LB",
"Type": "HTTP",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2bse"
}
],
"HealthChecker": {
"Type": "TCP",
"Port": 80,
"Interval": 30,
"Timeout": 5,
"HealthThreshold": 3,
"CriticalThreshold": 2
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherOriginGroup"
}
{
"Response": {
"RequestId": "afe08af5-51f3-4f2e-911b-987ebb88a572",
"InstanceId": "lb-2osbdyhu19iy"
}
}
This example shows you how to create a LoadBalancer by selecting UDP for a health check policy and OtherOriginGroup for a request retry policy.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lsnpaxol",
"Name": "UDP-LB",
"Type": "GENERAL",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z215e"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2bse"
}
],
"HealthChecker": {
"Type": "UDP",
"Port": 80,
"SendContext": "requestcontent",
"RecvContext": "responsecontent",
"Interval": 30,
"Timeout": 5,
"HealthThreshold": 3,
"CriticalThreshold": 2
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherOriginGroup"
}
{
"Response": {
"RequestId": "57d0154c-f9ab-42b7-ad83-232106647ff3",
"InstanceId": "lb-2oswhs520uqe"
}
}
This example shows you how to create a LoadBalancer by selecting OtherOriginGroup for a request retry policy without enabling any health check policy. It is suitable for scenarios with only primary and replica origin servers configured.
POST / HTTP/1.1
Host: teo.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateLoadBalancer
<Common request parameters>
{
"ZoneId": "zone-2ju9lrnpaxol",
"Name": "NoCheck-LB",
"Type": "HTTP",
"OriginGroups": [
{
"Priority": "priority_1",
"OriginGroupId": "og-30l5kv5z2bse"
},
{
"Priority": "priority_2",
"OriginGroupId": "og-30l5kv5z2ase"
}
],
"HealthChecker": {
"Type": "NoCheck"
},
"SteeringPolicy": "Pritory",
"FailoverPolicy": "OtherOriginGroup"
}
{
"Response": {
"RequestId": "2c619f7f-27e9-43c5-b42c-68dcca803d35",
"InstanceId": "lb-2osw2ssziowm"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
InvalidParameter.LoadBalancerNameRepeated | The LoadBalancer names under the same site should be unique. |
InvalidParameter.OriginGroupTypeCanNotMatchLBType | The type of the origin server group does not match the LoadBalancer type. |
InvalidParameter.SomeOriginGroupNotExist | Some bound origin server groups do not exist. |
LimitExceeded.LoadBalancingCountLimitExceeded | The number of LoadBalancers exceeds the limit. |
本页内容是否解决了您的问题?