tencent cloud

APIs

CreateLoadBalancer

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-11-25 16:58:54

1. API Description

Domain name for API request: teo.intl.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.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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

Site ID.

Name Yes String

Instance name, which can contain 1 to 200 characters, including a-z, A-Z, 0-9, underscores (_), and hyphens (-).

Type Yes String

Instance type. Valid values:

  • HTTP_V2: HTTP dedicated (V2). Supports adding HTTP dedicated and general origin server groups. Site acceleration services reference only (such as domain name service and rule engine). This instance type supports selecting the region to initiate probes, which can significantly reduce probe request volume but has lower sensitivity to origin server health awareness.
  • HTTP: HTTP dedicated (V1). Supports adding HTTP dedicated and general origin server groups. Site acceleration services reference only (such as domain name service and rule engine). This instance type does not support selecting the region to initiate probes. The probe request volume is large but has higher sensitivity to origin server health awareness.
  • GENERAL: General type. Supports adding general origin server groups only. Can be referenced by site acceleration services (such as domain name service and rule engine) and Layer-4 proxies. This instance type does not support selecting the region to initiate probes. The probe request volume is large but has higher sensitivity to origin server health awareness.
  • 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 between origin server groups. Valid values:

  • Pritory: Perform failover according to priority.
  • Default value: Pritory.
    FailoverPolicy No String

    Request retry policy when access to an origin server fails. For details, refer to Introduction to Request Retry Strategy. Valid values:

  • OtherOriginGroup: After a single request fails, retry with another origin server within the next lower priority origin server group.
  • OtherRecordInOriginGroup: After a single request fails, retry with another origin server within the same origin server group.
  • The default value is OtherRecordInOriginGroup.

    3. Output Parameters

    Parameter Name Type Description
    InstanceId String

    Cloud Load Balancer 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.

    4. Example

    Example1 Creating a LoadBalancer with Probe Disabled

    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.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "2c619f7f-27e9-43c5-b42c-68dcca803d35",
            "InstanceId": "lb-2osw2ssziowm"
        }
    }

    Example2 Creating a LoadBalancer with the Health Check Policy Set to HTTP

    This example shows you how to create a LoadBalancer by selecting HTTP for a health check policy and OtherRecordInOriginGroup for a request retry policy.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
            "InstanceId": "lb-2osw7z07dnyu"
        }
    }

    Example3 Creating a LoadBalancer with the Health Check Policy Set to HTTPS

    This example shows you how to create a LoadBalancer by selecting HTTPS for a health check policy and OtherRecordInOriginGroup for a request retry policy.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
            "InstanceId": "lb-2osw7z17dnyu"
        }
    }

    Example4 Creating a LoadBalancer with the Health Check Policy Set to ICMP Ping

    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.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "c2967195-cfd7-4bd0-ac05-d2eaccde6909",
            "InstanceId": "lb-2osw7z07dnyu"
        }
    }

    Example5 Creating a LoadBalancer with the Health Check Policy Set to TCP

    This example shows you how to create a LoadBalancer by selecting TCP for a health check policy and OtherOriginGroup for a request retry policy.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "afe08af5-51f3-4f2e-911b-987ebb88a572",
            "InstanceId": "lb-2osbdyhu19iy"
        }
    }

    Example6 Creating a LoadBalancer with the Health Check Policy Set to UDP

    This example shows you how to create a LoadBalancer by selecting UDP for a health check policy and OtherOriginGroup for a request retry policy.

    Input Example

    POST / HTTP/1.1
    Host: teo.intl.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"
    }

    Output Example

    {
        "Response": {
            "RequestId": "57d0154c-f9ab-42b7-ad83-232106647ff3",
            "InstanceId": "lb-2oswhs520uqe"
        }
    }

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    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.LoadBalancerBindOriginGroupInvalid The origin server group bound to the load balancer is invalid.
    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.

    도움말 및 지원

    문제 해결에 도움이 되었나요?

    피드백