All Products
Search
Document Center

Edge Security Acceleration:CreateLoadBalancer

Last Updated:Mar 24, 2025
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Add a New Load Balancer

Operation description

Through this API, users can configure load balancing services according to their business needs, including but not limited to adaptive routing, weighted round-robin, rule matching, health checks, and other settings, to achieve effective traffic management and optimization.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
esa:CreateLoadBalancercreate
*Site
acs:esa:{#regionId}:{#accountId}:site/{#SiteId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NamestringYes

The name of the load balancer, which must meet the domain name format validation and be a subdomain under the site.

lb.example.com
EnabledbooleanNo

Whether the load balancer is enabled.

  • true: Enabled.
  • false: Not enabled.
true
SiteIdlongYes

Site ID, which can be obtained by calling the ListSites interface.

123456789****
AdaptiveRoutingobjectNo

Configuration for failover across pools.

FailoverAcrossPoolsbooleanNo

Whether to failover across pools.

  • true: Yes.
  • false: No.
true
DefaultPoolsarrayYes

List of default pools.

longYes

ID of the default pool, an integer.

95223818027****
FallbackPoollongYes

Fallback pool ID, where traffic will be directed when all other pools are unavailable.

123
RandomSteeringobjectNo

Weighted round-robin configuration, used to control the traffic distribution weights among different pools.

DefaultWeightintegerNo

Default weight for round-robin, used for all pools that do not have a specific weight set. The value range is an integer between 0 and 100.

50
PoolWeightsobjectNo

Weight configuration for each backend server pool, with the key being the pool ID and the value being the weight coefficient. The weight coefficient represents the proportion of relative traffic distribution.

integerNo

Weight for a single origin pool, a number between 0 and 100, where 0 means no traffic will be directed to that pool.

50
Rulesarray<object>No

Rule information.

{ "ENAM": [ 12345678**** ], "WNAM": [ 23456789****, 23456789**** ] }
objectNo

Rule structure.

RuleNamestringNo

Rule name. This parameter does not need to be set when adding global configurations.

rule_1
RulestringNo

Rule content, using conditional expressions to match user requests. This parameter does not need to be set when adding global configurations. There are two usage scenarios:

  • Match all incoming requests: Set the value to true
  • Match specific requests: Set the value to a custom expression, e.g., (http.host eq "video.example.com")
(http.request.method eq "GET" and http.request.version eq "HTTP/1.0") or (ip.geoip.country eq "CN") or (http.host eq "www.example.com")
RuleEnablestringNo

Rule switch. This parameter does not need to be set when adding global configurations. Value range:

  • on: Enable.
  • off: Disable.
on
FixedResponseobjectNo

Execute a specified response after matching the rule.

ContentTypestringNo

Content-Type field in the HTTP Header.

application/octet-stream
LocationstringNo

Location field in the HTTP response.

http://www.example.com/index.html
MessageBodystringNo

Response body value.

Hello World!
StatusCodeintegerNo

Response status code.

200
OverridesanyNo

Modify the corresponding load balancing configuration after matching the rule. The fields in the configuration will override the corresponding fields in the load balancer configuration.

{ "adaptive_routing": { "failover_across_pools": true }, "sub_region_pools": { "AL,AT": [ 92298024898****, 92304347804**** ], "BG,BY": [ 92298024898**** ] }, "default_pools": [ 92298024898****, 92304347804**** ], "fallback_pool": 92298024898****, "location_strategy": { "mode": "resolver_ip", "prefer_ecs": "always" }, "random_steering": { "default_weight": 0.3, "pool_weights": { "92298024898****": 0.7, "92304347804****": 0.8 } }, "region_pools": { "CN,SEAS": [ 92298024898****, 92304347804**** ], "SAF,SAS": [ 92304347804**** ] }, "session_affinity": "ip", "steering_policy": "geo", "ttl": 30 }
SequenceintegerNo

The execution order of the rule. It can be left blank, in which case the rules will be executed in the order they appear in the list. If specified, it should be an integer greater than 0, with higher values indicating a higher priority for execution.

1
TerminatesbooleanNo

Whether to terminate the execution of subsequent rules.

  • true: Yes.
  • false: No, default value.
true
SessionAffinitystringNo

Session persistence, with possible values:

  • off: Not enabled.
  • ip: Session persistence by IP.
  • cookie: Session persistence by cookie.
ip
SteeringPolicystringYes

Load balancing strategy.

  • geo: Geographic strategy.
  • random: Weighted round-robin.
  • order: Primary and backup method.
order
DescriptionstringNo

Detailed description of the load balancer, for easier management and identification.

TtlintegerNo

TTL value, the time-to-live for DNS records, with a default of 30 seconds. The value range is 10-600.

300
MonitorobjectYes

Monitor configuration, used for health checks.

TypestringNo

Monitor protocol type, such as HTTP, used for health checks. When set to off, no check is performed.

  • TCP
  • UDP
  • SMTP
  • HTTPS
  • HTTP
  • ICMP Ping
  • off
HTTP
MethodstringNo

Monitor request method, such as GET, which is a method in the HTTP protocol.

GET
PortintegerNo

Origin server port.

1921
PathstringNo

Monitor check path, such as /healthcheck, which is the HTTP request path.

/health
IntervalintegerNo

Monitoring interval, such as 60 seconds, representing the frequency of checks.

60
TimeoutintegerNo

Application health check timeout, in seconds, with a value range of 1-10.

5
ExpectedCodesstringNo

Expected status codes, such as 200,202, indicating successful HTTP responses.

200
FollowRedirectsbooleanNo

Whether to follow redirects.

  • true: Yes.
  • false: No.
true
ConsecutiveUpintegerNo

Number of consecutive successful probes required to consider the target healthy, such as 3.

3
ConsecutiveDownintegerNo

Number of consecutive failed probes required to consider the target unhealthy, such as 5.

5
HeaderanyNo

Header information included in the probe, which is the HTTP header.

{ "host": [ "example1.com", "example2.com" ] }
SubRegionPoolsanyNo

Address pools corresponding to secondary regions. When multiple secondary regions share a set of address pools, the keys can be concatenated with commas.

{"AL,MO": [92298024898****],"CN-SH,CN-SX,CN-SC":[92304347804****,92843536908****]}
RegionPoolsanyNo

Address pools corresponding to primary regions.

{ "ENAM": [ 12345678**** ], "WNAM": [ 23456789****, 23456789**** ] }

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

Request ID.

EEEBE525-F576-1196-8DAF-2D70CA3F4D2F
Idlong

Load balancer ID.

99867648760****

Examples

Sample success responses

JSONformat

{
  "RequestId": "EEEBE525-F576-1196-8DAF-2D70CA3F4D2F\n",
  "Id": 0
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameterThe specified parameter is invalid.The specified parameter is invalid.
400LoadBalancerQuotaCheckFailedLoad balancer enable quota check failed.Your current plan cannot use the load balancer related functions. If you need to use it, upgrade the plan.
400LoadBalancerNumberExceedQuotaLimitThe number of load balancers you have added has reached the limit of the plan quota. Please delete the unused load balancers or upgrade the plan and try again.The number of load balancers you have added has reached the limit of the plan quota. Please delete the unused load balancers or upgrade the plan and try again.
400LoadBalancerRuleQuotaCheckFailedYour current plan does not support configuring load balancer custom rules, or the load balancer rules you have added exceed the plan quota limit. Please upgrade the plan or delete the rules that are no longer in use and try again.Your current plan does not support configuring load balancer custom rules, or the load balancer rules you have added exceed the plan quota limit. Please upgrade the plan or delete the rules that are no longer in use and try again.
400LoadBalancerPolicyCheckFailedYour current plan does not support the load balancer scheduling policy. Upgrade the plan and try again.Your current plan does not support the load balancer scheduling policy. Upgrade the plan and try again.
400LoadBalancerHealthDetectionQuotaCheckFailedYour current plan does not allow you to configure the load balancer's health detection. Upgrade the plan and try again.Your current plan does not allow you to configure the load balancer's health detection. Upgrade the plan and try again.
400LoadBalancerHealthDetectionIntervalCheckFailedThe configured load balancer health detection interval exceeds the quota range allowed by the plan. Please revise the interval within the range or upgrade the plan and try again.The configured load balancer health detection interval exceeds the quota range allowed by the plan. Please revise the interval within the range or upgrade the plan and try again.
400InternalExceptionFailed to call the service. Try again later or contact technical support.Failed to call the service. Try again later or contact technical support.
400Instance.NotOnlineYour plan is unavailable due to an overdue payment. Complete the payment first.Your plan is unavailable due to an overdue payment. Complete the payment first.
400MonitorExpectedBodyInvalidInvalid response body. Specify a response body that does not exceed 102,400 characters in length in your custom rule.Invalid response body. Specify a response body that does not exceed 102,400 characters in length in your custom rule.
400MonitorExpectedCodesInvalidInvalid expected status code for the probe.Make sure that you specify no more than 10 status codes in the probe settings, and each status code must be 3 to 4 characters in length.Examples: 200, 301, 3xx, 8000, and 88xx.Invalid expected status code for the probe.Make sure that you specify no more than 10 status codes in the probe settings, and each status code must be 3 to 4 characters in length.Examples: 200, 301, 3xx, 8000, and 88xx.
400MonitorHeaderInvalidInvalid request header for the probe. You can add up to 10 request headers, each with 1 to 9 values. The combined length of all headers and values cannot exceed 6,000 characters. You cannot configure the User-Agent header.The incoming monitor is carrying an illegal request header. Make sure that the number of request headers does not exceed 10, that each request header has a value length between 1 and 10, and that you must not use the User-Agent request header (which is reserved for internal specific scenarios). In addition, the total length of all request headers and their values must not exceed 6000 characters. Please check and correct the request header configuration and try again.
400MonitorMethodNotSupportInvalid HTTP method for the probe request. Valid values are GET and HEAD.Invalid HTTP method for the probe request. Valid values are GET and HEAD.
400MonitorPathNotSupportInvalid probe URL path.If you set the probe protocol to HTTP or HTTPS, make sure you specify a probe URL path that does not exceed 1,024 characters in length.Invalid probe URL path.If you set the probe protocol to HTTP or HTTPS, make sure you specify a probe URL path that does not exceed 1,024 characters in length.
400MonitorPortNotSupportInvalid probe port. Specify a valid port from 1 to 65535 for the probe request. Then, try again.The incoming monitor listening port is not supported. The port value range is [1-65535]. Please ensure that the port is within the value range and try again.
400MonitorRetriesInvalidInvalid number of probe retries. Specify an integer from 0 to 5. Then, try again.Invalid number of probe retries. Specify an integer from 0 to 5. Then try again.
400MonitorTimeoutInvalidInvalid timeout for the probe. Valid values are 1 to 10.Invalid timeout for the probe. Valid values are 1 to 10.
400MonitorTypeNotSupportInvalid protocol. Valid values are off, HTTP, HTTPS, TCP, UDP, ICMP Ping, and SMTP.Invalid protocol. Valid values are off, HTTP, HTTPS, TCP, UDP, ICMP Ping, and SMTP.
400OriginPoolNotExistThe specified origin pool does not exist or does not belong to your account or website. Check and try again.The specified origin pool does not exist or does not belong to your account or website. Check and try again.
400LoadBalancerNameConflictThe load balancer name or the hostname for the origin pool already exists. Try again with a unique name.The load balancer name or the hostname for the origin pool already exists. Try again with a unique name.
400LockFailedThe system is handling requests you previously submitted. Try again later.The system is handling requests you previously submitted. Try again later.
400SourceCircleExistThe host record of the resource to be operated on is already the source station of another resource, or the source station of the current resource has been added as a host record. To avoid loopback, modify the host record or source station and retry.The host record of the resource to be operated on is already the source station of another resource, or the source station of the current resource has been added as a host record. To avoid loopback, modify the host record or source station and retry.
403QuotaExceededThe quota is exceeded.The quota is exceeded.
404SiteNotFoundThe website does not exist or does not belong to you.The website does not exist or does not belong to you.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2025-02-13The Error code has changed. The request parameters of the API has changedView Change Details
2025-02-10The Error code has changedView Change Details