全部产品
Search
文档中心

边缘安全加速:UpdateLoadBalancer - 修改已有负载均衡器信息

更新时间:Jan 15, 2026

修改已有的负载均衡器信息,需要带上负载均衡器ID来标识要修改哪个负载均衡器。

接口说明

通过此接口,您可以修改负载均衡器的多项配置,包括但不限于负载均衡器的名称、是否开启加速、会话保持策略、以及与流量路由相关的各种高级设置。

重要 某些参数的更改可能会影响现有服务的稳定性,请谨慎操作。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

esa:UpdateLoadBalancer

update

*Site

acs:esa:{#regionId}:{#accountId}:site/{#SiteId}

请求参数

名称

类型

必填

描述

示例值

Enabled

boolean

负载均衡器是否启用。

  • true:启用。

  • false:不启用。

枚举值:

  • true :

    true

  • false :

    false

true

SiteId

integer

站点 ID,可通过调用 ListSites 接口获取。

1159101787****

AdaptiveRouting

object

跨地址池回源配置。

FailoverAcrossPools

boolean

是否跨地址池回源。

  • true:是。

  • false: 否。

false

DefaultPools

array

默认地址池 ID 列表。

integer

默认地址池 ID,整型。

96228666776****

FallbackPool

integer

兜底地址池 ID,当所有其他池不可用时,流量将被导向此处。

96228666776****

RandomSteering

object

加权轮询配置,用于控制不同地址池的流量分配权重。

DefaultWeight

integer

默认的轮询权重,用于所有没有单独指定权重的地址池。取值范围:0-100 之间的整数。

50

PoolWeights

object

各后端服务器池的权重配置,键为池 ID,值为权重系数。权重系数表示相对流量分配的比例。

integer

单个源地址池的权重,0-100 的数字,0 表示不往该源地址池调度流量。

50

Rules

array<object>

规则配置列表,用于定义特定条件下的行为覆盖。

array<object>

规则信息。

RuleName

string

规则名称。添加全局配置的时候不需要设置该参数。

rule_1

Rule

string

规则内容,使用条件表达式来匹配用户请求。添加全局配置的时候不需要设置该参数。存在两种使用场景:

  • 匹配所有传入请求:值设置为 true

  • 匹配指定请求:值设置为自定义表达式,例如:(http.host eq "video.example.com")

http.request.method eq "GET"

RuleEnable

string

规则开关。添加全局配置的时候不需要设置该参数。取值范围:

  • on:开启。

  • off:关闭。

on

FixedResponse

object

匹配规则后执行响应指定内容。

ContentType

string

HTTP Header 中的 Content-Type 字段。

application/json

Location

string

HTTP 返回中的 Location 字段。

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

MessageBody

string

响应 Body 值。

Hello World!

StatusCode

integer

响应状态码。

200

Overrides

any

匹配规则后修改对应请求改写的负载均衡配置,配置的字段,会覆盖负载均衡器配置里相应的字段。

{ "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 }

Sequence

integer

规则执行顺序,可以不填,不填时以列表顺序执行,如果填的话,是大于 0 的整数。数值越大越优先执行。

1

Terminates

boolean

是否终止执行后续规则。

  • true:是。

  • false:否,默认值。

true

SessionAffinity

string

会话保持,取值:

  • off:不开启。

  • ip:按 ip 方式会话保持。

  • cookie: 按 cookie 方式会话保持。

ip

SteeringPolicy

string

负载均衡策略。

order

Description

string

负载均衡器的详细描述信息,便于管理和识别。

负载均衡器描述

Ttl

integer

TTL 值,DNS 记录的生存时间,默认为 30,取值范围:10-600。

300

Monitor

object

监视器配置,用于健康检查。

Type

string

监视器协议类型,如 HTTP,用于健康检查,值为 off 时,表示不进行检查。

HTTP

Method

string

监视器请求方法,如 GET,HTTP 协议中的方法。

GET

Port

integer

源站端口。

80

Path

string

监视器检查路径,如/healthcheck,HTTP 请求路径。

/health

Interval

integer

监视间隔,如 60 秒,检查频率。

100

Timeout

integer

应用健康检查超时时间,单位为秒,取值范围:1-10。

5

ExpectedCodes

string

预期状态码,如 200,202,成功的 HTTP 响应。

200,202

FollowRedirects

boolean

是否跟随重定向。

  • true:是。

  • false:否。

true

ConsecutiveUp

integer

连续探测多少次成功算成功,如 3。

3

ConsecutiveDown

integer

连续探测多少次失败算失败,如 5。

5

Header

any

监视请求头配置。

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

MonitoringRegion

string

探测点所在区域,默认为 Global,

  • Global: 全球。

  • ChineseMainland: 中国内地。

  • OutsideChineseMainland: 全球(不包括中国内地)。

枚举值:

  • OutsideChineseMainland :

    OutsideChineseMainland

  • ChineseMainland :

    ChineseMainland

  • Global :

    Global

Global

Id

integer

负载均衡器 ID,可通过调用 ListLoadBalancers 接口获取。

95913670174****

RegionPools

any

一级 region 对应的地址池。

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

SubRegionPools

any

二级 region 对应的地址池,多个二级 region 共用一批地址池时,可以多个二级 region,使用逗号拼接作为 key。

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

返回参数

名称

类型

描述

示例值

object

修改负载均衡器成功后的响应结构。

RequestId

string

请求 ID。

EEEBE525-F576-1196-8DAF-2D70CA3F4D2F

示例

正常返回示例

JSON格式

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

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter The specified parameter is invalid. 输入参数规范校验失败。
400 LoadBalancerQuotaCheckFailed Load balancer enable quota check failed. 您当前的套餐无法使用负载均衡器相关功能,如需使用,请进行套餐升级。
400 LoadBalancerNumberExceedQuotaLimit 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. 您添加的负载均衡器数量已经达到套餐配额限制,请删除不使用的负载均衡器或者升级套餐后进行重试。
400 LoadBalancerRuleQuotaCheckFailed 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. 您当前的套餐不支持配置负载均衡器自定义规则,或者您已经添加的负载均衡器规则超过套餐配额限制,请升级套餐或者删除不再使用的规则后重试。
400 LoadBalancerPolicyCheckFailed Your current plan does not support the load balancer scheduling policy. Upgrade the plan and try again. 您当前的套餐不支持使用该负载均衡器调度策略,请升级套餐后重试。
400 LoadBalancerHealthDetectionQuotaCheckFailed Your current plan does not allow you to configure the load balancer's health detection. Upgrade the plan and try again. 您当前的套餐不允许配置负载均衡器的健康探测,请升级套餐后重试。
400 LoadBalancerHealthDetectionIntervalCheckFailed 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. 您配置的负载均衡器健康探测时间间隔超出了套餐允许的配额范围,请订正为范围内的间隔或者升级套餐后,进行重试。
400 InternalException Failed to call the service. Try again later or contact technical support. 调用服务失败,请稍后重试或联系客服咨询详情。
400 Instance.NotOnline Your plan is unavailable due to an overdue payment. Complete the payment first. 您的套餐实例因欠费当前处于非上线状态,请先完成续费操作以继续使用。
400 MonitorExpectedBodyInvalid Invalid response body. Specify a response body that does not exceed 102,400 characters in length in your custom rule. 传入的监视器预期返回值不正确,长度不能大于102400字符,请您确认返回值后重试。
400 MonitorExpectedCodesInvalid 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. 传入的监视器预期返回码不合法。请注意:返回码的数量不能超过10个,且每个返回码的长度应不少于3个字符且不超过4个字符。例如:200、301、3xx、8000、88xx。
400 MonitorHeaderInvalid Invalid 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. 传入的监视器携带的请求头非法。请确保请求头数量不超过10个,每个请求头的值长度在1到10之间,并且不得使用User-Agent请求头(该请求头保留用于内部特定场景)。此外,所有请求头及其值的总长度不得超过6000个字符。请您检查并修正请求头配置后重试。
400 MonitorMethodNotSupport Invalid HTTP method for the probe request. Valid values are GET and HEAD. 传入的监视器请求方法不支持,只支持以下方法:GET/HEAD。
400 MonitorPathNotSupport 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. 传入的监听路径不支持。当监听类型为HTTP或HTTPS时,监听路径不能为空,且路径长度不得超过1024个字符,请您检查路径后重试。
400 MonitorPortNotSupport Invalid probe port. Specify a valid port from 1 to 65535 for the probe request. Then, try again. 传入的监视器监听端口不支持,端口取值范围:[1-65535],请您确保端口在取值范围内重试。
400 MonitorRetriesInvalid Invalid number of probe retries. Specify an integer from 0 to 5. Then, try again. 传入的监视器重试次数参数不支持,支持的重试次数取值范围为:[0-5],请确保设置的重试次数在此范围内。
400 MonitorTimeoutInvalid Invalid timeout for the probe. Valid values are 1 to 10. 传入的监视器超时时间超出取值范围,支持以下范围:[1-10]。
400 MonitorTypeNotSupport Invalid protocol. Valid values are off, HTTP, HTTPS, TCP, UDP, ICMP Ping, and SMTP. 传入的监视器类型不支持,监视器只支持以下类型:off/HTTP/HTTPS/TCP/UDP/ICMP Ping/SMTP。
400 OriginPoolNotExist The specified origin pool does not exist or does not belong to your account or website. Check and try again. 传入的源地址池不存在,或该地址池不属于当前用户和站点,请您确认后重试。
400 LoadBalancerNameConflict The load balancer name or the hostname for the origin pool already exists. Try again with a unique name. 负载均衡器名称或源地址池记录名已存在,请更换一个唯一的名字重试。
400 LockFailed The system is handling requests you previously submitted. Try again later. 您有其他请求正在处理中,请稍后再进行重试。
400 SourceCircleExist 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. 当前要操作资源的主机记录已经是其他资源的源站,或者当前资源的源站已经被添加为主机记录,为避免回环产生,请修改主机记录或者源站后进行重试。
400 LoadBalancerNotExist The specified load balancer name is invalid or load balancing is not enabled for your website.Make sure that you specify a valid load balancer name and load balancing is enabled. Then, try again. 传入的站点负载均衡器无效或当前站点尚未开通负载均衡功能。请您检查负载均衡器名称配置的是否正确后重试,若尚未开通负载均衡功能请开通后重试。
400 MissingParameter The specified ArgName is required for this function. 配置特定功能时,缺少必传参数。
403 QuotaExceeded The quota is exceeded. 额度不足
404 SiteNotFound The website does not exist or does not belong to you. 站点不存在,或者不属于你。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情