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 A newly created listener is 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 -1

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

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. Then, bandwidth of the listener 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 backend servers 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, and destination port. Requests that contain the same information based on the four factors 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 high-performance CLB instances support the sch, tch, and qch consistent hashing algorithms.

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.

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 specified by 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-cige6j8****

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 be associated with the listener.

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 ACL are forwarded. Whitelists apply 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. Risks may arise if the whitelist is improperly set.

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

  • black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application.

    If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.

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 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 (_).

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=-1
&ListenerPort=80
&LoadBalancerId=lb-bp1ygod3yctvg1y7****
&<Common request parameters>

Sample success responses

XML format

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

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 specified VServerGroupId or MasterSlaveServerGroupId parameter is invalid.
400 LbNotSupportTcpssl You cannot create a TCP SSL type listener for the specified load balancer. The error message returned because the specified CLB instance does not support TCP 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 TCP 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 HealthCheckReq 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.SpecialListenerPortNotAllowed The operation is not allowed because port 4789 is reserved by the system. The error message returned because port 4789 is reserved by the system and the operation is rejected.
400 Mismatch.SlbSpecTypeAndListenerProtocol The SlbSpecType and ListenerProtocol are mismatched. The error message returned because the specified instance type and listener type do not match.
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 resource-shared instances do not support the FullNatEnabled parameter.

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