Creates a UDP listener.

You cannot query the source IP addresses of requests if you create UDP listeners for a Classic Load Balancer (CLB) instance that is deployed in a classic network.

Note Newly created listeners are in the stopped state. After a listener is created, you can call the StartLoadBalancerListener operation to start the listener. After the listener is started, the listener can forward traffic to backend servers.

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 CreateLoadBalancerUDPListener

The operation that you want to perform.

Set the value to CreateLoadBalancerUDPListener.

Bandwidth Integer Yes 34

The maximum bandwidth value of the listener.

Valid values: -1 and 1 to 5120.

  • -1: For a pay-by-data-transfer Internet-facing CLB instance, you can set the value to -1. This indicates that the bandwidth is unlimited.
ListenerPort Integer Yes 80

The frontend port that is used by the CLB instance.

Valid values: 1 to 65535.

LoadBalancerId String Yes lb-bp1ygod3yctvg1y7******

The ID of the CLB instance.

RegionId String Yes cn-hangzhou

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

BackendServerPort Integer No 80

The backend port that is used by the CLB instance. Valid values: 1 to 65535.

If the VServerGroupId parameter is not set, this parameter is required.

Scheduler String No wrr

The scheduling algorithm. Valid values:

  • wrr (default): Backend servers with higher weights receive more requests than those with lower weights.
  • 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 four factors: source IP address, destination IP address, source port number, and destination port number. 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.

Only guaranteed-performance CLB instances support sch, tch, and qch.

HealthyThreshold Integer No 4

The number of consecutive successful health checks that must occur before an unhealthy backend server is declared healthy. In this case, the health check state is changed from fail to success.

Valid values: 2 to 10.

UnhealthyThreshold Integer No 4

The number of consecutive failed health checks that must occur before a healthy backend server is declared unhealthy. In this case, the health check state is changed from success to fail.

Valid values: 2 to 10.

HealthCheckConnectTimeout Integer No 100

The time period to wait for 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.

Valid values: 1 to 300. Unit: seconds.

HealthCheckConnectPort Integer No 80

The port that is used for health checks. Valid values: 1 to 65535.

If this parameter is not set, the port that is specified in BackendServerPort is used for health checks.

healthCheckInterval Integer No 3

The time interval between two consecutive health checks.

Valid values: 1 to 50. Unit: seconds.

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.

VServerGroupId String No rsp-cige6j****8

The ID of the vServer group.

MasterSlaveServerGroupId String No rsp-0bfucwu****

The ID of the primary/secondary server group.

Note You cannot specify the vServer group ID and primary/secondary server group ID at the same time.
AclId String No 123

The ID of the access control list (ACL) to which the listener is bound.

This parameter is required if the AclStatus parameter is set to on.

AclType String No white

The type of the ACL. Valid values:

  • white: specifies the ACL as the whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios where you want to allow only specific IP addresses to access an application. After a whitelist is configured, only IP addresses in the whitelist can access the CLB listener, which can lead to specific business risks.

    After a whitelist is enabled for a listener, if no IP address is added to the whitelist, the listener does not distribute requests.

  • black: All requests from IP addresses or address segments set in the selected RAM policy group will not be forwarded. Blacklist is applicable to scenarios where applications only restrict access to certain IP addresses.

    If the blacklist is enabled but the corresponding ACL does not contain IP addresses, the CLB listener forwards all requests.

This parameter takes effect if the AclStatus parameter is set to on.

AclStatus String No off

Specifies whether to enable the access control feature.

Valid values: on and off. Default value: off.

Description String No test

The description of the listener.

The description must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.),and underscores (_). Chinese characters are supported.

Response parameters

Parameter Type Example Description
RequestId String 06F00FBB-3D9E-4CCE-9D43-1A6946A75456

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateLoadBalancerUDPListener
&Bandwidth=34
&ListenerPort=80
&LoadBalancerId=lb-bp1ygod3yctvg1y7******
&<Common request parameters>

Sample success responses

XML format

<CreateLoadBalancerUDPListenerResponse>
	  <RequestId>06F00FBB-3D9E-4CCE-9D43-1A6946A75456</RequestId>
</CreateLoadBalancerUDPListenerResponse>

JSON format

{
    "RequestId": "06F00FBB-3D9E-4CCE-9D43-1A6946A75456"
}

Error codes

HttpCode Error code Error message Description
400 Abs.VServerGroupIdAndMasterSlaveServerGroupId.MissMatch The parameters VServerGroupId or MasterSlaveServerGroupId miss match. The error message returned because the VServerGroupId parameter or the MasterSlaveServerGroupId parameter does not match.
400 LbNotSupportTcpssl You cannot create a TCP SSL type listener for the specified load balancer. The error message returned because the specified instance does not allow you to create tcpssl listeners.
400 LbSupportTcpsslOnly The specified load balancer supports TCP SSL type listener only. The error message returned because the specified instance allows you to create only tcpssl listeners.
400 ListenerNotSupportRule You cannot create a rule for the specified listener. The error message returned because the specified listener does not allow you to create forwarding rules.
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 VipNotSupportQuicVersion The listener does not support the parameter of QuicVersion. The error message returned because the listener does not support the QuicVersion parameter.

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