Modifies the configurations of a UDP listener.

Prerequisites

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes SetLoadBalancerUDPListenerAttribute

The operation that you want to perform.

Set the value to SetLoadBalancerUDPListenerAttribute.

ListenerPort Integer Yes 80

The frontend port that is used by the CLB instance.

Valid values: 1 to 65535.

LoadBalancerId String Yes lb-bp1rtfnodmywb43ecu4sf-c****

The ID of the CLB instance.

RegionId String Yes cn-hangzhou

The ID of the region where the CLB instance is deployed.

Bandwidth Integer No -1

The maximum bandwidth of the listener. Unit: Mbit/s. Valid values:

  • -1: For a pay-by-data-transfer Internet-facing CLB instance, you can set the value to -1. Then, bandwidth of the listener is unlimited.
  • 1 to 5120: For a pay-by-bandwidth Internet-facing CLB instance, you can specify the bandwidth limit of each listener. The sum of bandwidth limit values that you set for all listeners cannot exceed the bandwidth limit of the CLB instance.
Scheduler String No wrr

The scheduling algorithm. Valid values:

  • wrr: Backend servers that have higher weights receive more requests than backend servers that have lower weights.

    If two backend servers have the same weight, the backend server with fewer connections is more likely to be scheduled and receives more requests.

  • rr: Requests are distributed to backend servers in sequence.
  • sch: specifies consistent hashing that is based on source IP addresses. Requests from the same source IP address are distributed to the same backend server.
  • tch: specifies consistent hashing that is based on the following parameters: source IP address, destination IP address, source port, and destination port. Requests that contain the same preceding information are distributed to the same backend server.
  • qch: specifies consistent hashing that is based on QUIC connection IDs. Requests that contain the same QUIC connection ID are distributed to the same backend server.
Note
  • Only high-performance instances support sch, tch, and qch.
  • CLB does not support converting the wrr and rr algorithms to sch, tch, or qch. You cannot switch the hash algorithm from one to another.
HealthyThreshold Integer No 4

The number of health checks that an unhealthy backend server must consecutively pass before it can be declared healthy (from fail to success).

Valid values: 2 to 10.

UnhealthyThreshold Integer No 4

The number of health checks that a healthy backend server must consecutively fail before it can be declared unhealthy (from success to fail).

Valid values: 2 to 10.

HealthCheckConnectTimeout Integer No 100

The timeout period of a health check response. If a backend Elastic Compute Service (ECS) instance does not send an expected response within the specified period of time, the ECS instance is considered unhealthy. Unit: seconds.

Valid values: 1 to 300.

Note If the value of the HealthCheckConnectTimeout parameter is smaller than that of the HealthCheckInterval parameter, the timeout period specified by the HealthCheckConnectTimeout parameter is ignored and the period of time specified by the HealthCheckInterval parameter is used as the timeout period.
HealthCheckConnectPort Integer No 80

The port that is used for health checks.

Valid values: 1 to 65535.

HealthCheckInterval Integer No 5

The interval of health check retries. Unit: seconds.

Valid values: 1 to 50.

healthCheckReq String No hello

The request string for UDP listener health checks. The string must be 1 to 64 characters in length and can contain only letters and digits.

healthCheckExp String No ok

The response string for UDP listener health checks. The string must be 1 to 64 characters in length and can contain only letters and digits.

VServerGroup String No on

Specifies whether to use a vServer group. Valid values:

  • on: yes
  • off: no
Note You cannot set both VserverGroup and MasterSlaveServerGroup to on.
VServerGroupId String No rsp-cige6****

The ID of the vServer group.

MasterSlaveServerGroupId String No rsp-0bfuc****

The ID of the primary/secondary server group.

Note You cannot set both VServerGroupId and MasterSlaveServerGroupId.
MasterSlaveServerGroup String No on

Specifies whether to use a primary/secondary server group. Valid values:

  • on: yes
  • off: no
Note You must set VserverGroup and MasterSlaveServerGroup to on.
AclId String No off

The ID of the access control list (ACL) to be associated with the listener.

Note If AclStatus is set to on, this parameter is required.
AclType String No white

The type of the ACL. Valid values:

  • white: a whitelist. Only requests from the IP addresses or CIDR blocks in the network ACL are forwarded. Whitelists apply to scenarios where you want to allow only specific IP addresses to access an application. Risks may arise if the whitelist is improperly set. After the whitelist is set, only requests from IP addresses that are added to the whitelist are forwarded by the listener.

    If the whitelist does not contain IP addresses, the CLB listener forwards all requests.

  • black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are rejected. Blacklists apply to scenarios where you want to block access from specified IP addresses to an application.

    If no IP address is added to the blacklist, the listener forwards all requests.

Note If AclStatus is set to on, this parameter is required.
AclStatus String No off

Specifies whether to enable the access control feature. Valid values:

  • on: yes
  • off: no
Description String No test

The description of the listener.

Response parameters

Parameter Type Example Description
RequestId String CEF72CEB-54B6-4AE8-B225-F876FF7BA984

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=SetLoadBalancerUDPListenerAttribute
&ListenerPort=80
&LoadBalancerId=lb-bp1rtfnodmywb43ecu4sf-c****
&<Common request parameters>

Sample success responses

XML format

<SetLoadBalancerUDPListenerAttributeResponse>
     <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</SetLoadBalancerUDPListenerAttributeResponse>

JSON format

{
    "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Error codes

HttpCode Error code Error message Description
400 InvalidParamLength.HealthCheckReq The length of the parameter HealthCheckReq is invalid. The error message returned because the value of the HealthCheckReq parameter is invalid in length.
400 InvalidParamLength.HealthCheckExp The length of the parameter HealthCheckExp is invalid. The error message returned because the value of the HealthCheckReq parameter is invalid in length.
400 VipNotSupportQuicVersion The listener does not support the parameter of QuicVersion. The error message returned because the listener does not support the QuicVersion parameter.
400 OperationDenied.OnlyIpv4SlbSupport The operation is not allowed because of OnlyIpv4SlbSupport. The error message returned because only IPv4 instances support the full NAT mode.
400 OperationDenied.FullNatModeNotAllowed The operation is not allowed because of FullNatModeNotAllowed. The error message returned because the full NAT mode is not supported.
400 SpecNotSupportParameter The instance with share spec does not support FullNatEnabled parameter. The error message returned because shared-resource instances do not support the FullNatEnabled parameter.

For a list of error codes, visit the API Error Center.