Creates a UDP listener.

UDP listeners of Classic Load Balancer (CLB) instances in a classic network cannot pass client IP addresses to backend servers.

Note A newly created listener is in the stopped state. After a listener is created, you can call the StartLoadBalancerListener operation to enable the listener to 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
RegionId String No cn-hangzhou

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

Action String Yes CreateLoadBalancerUDPListener

The operation that you want to perform. Set the value to CreateLoadBalancerUDPListener.

LoadBalancerId String Yes lb-bp1ygod3yctvg1y7****

The ID of the CLB instance.

ListenerPort Integer Yes 80

The frontend port used by the CLB instance.

Valid values: 1 to 65535.

BackendServerPort Integer No 80

The backend port used by the CLB instance.

Valid values: 1 to 65535.

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

Bandwidth Integer Yes -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 this parameter to -1. This way, the bandwidth of the listener is unlimited.

Scheduler String No wrr

The routing 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 times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. In this case, the health status is changed from fail to success.

Valid values: 2 to 10.

UnhealthyThreshold Integer No 4

The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. In this case, the health status is changed from success to fail.

Valid values: 2 to 10.

HealthCheckConnectTimeout Integer No 100

The timeout period of a health check.

If a backend server, such as an Elastic Compute Service (ECS) instance, does not respond to a probe packet within the specified timeout period, the server fails the health check. Unit: seconds.

Valid values: 1 to 300.

HealthCheckConnectPort Integer No 80

The port that is used for health checks.

Valid values: 1 to 65535.

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

healthCheckInterval Integer No 3

The interval between two consecutive health checks. 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.

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 can set only one of the VServerGroupId and MasterSlaveServerGroupId parameters.
AclId String No 123

The ID of the network ACL that is associated with the listener.

If AclStatus is set to on, this parameter is required.

AclType String No white

The type of the network 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 in which 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 a whitelist is configured but no IP address is added to the whitelist, the listener forwards all requests.

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

    If a blacklist is configured for a listener but no IP address is added to the blacklist, the listener forwards all requests.

If AclStatus is set to on, this parameter is required.

AclStatus String No off

Specifies whether to enable access control. Valid values:

  • on: yes
  • off (default): no
Description String No udp_80

The name of the listener.

The name must be 1 to 256 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_).

ProxyProtocolV2Enabled Boolean No false

Specifies whether to use the Proxy protocol to pass client IP addresses to backend servers. Valid values:

  • true: yes
  • false (default): no
HealthCheckSwitch String No on

Specifies whether to enable the health check feature. Valid values:

  • on (default): yes
  • off: no

Response parameters

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

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=cn-hangzhou
&Action=CreateLoadBalancerUDPListener
&LoadBalancerId=lb-bp1ygod3yctvg1y7****
&ListenerPort=80
&BackendServerPort=80
&Bandwidth=-1
&Scheduler=wrr
&HealthyThreshold=4
&UnhealthyThreshold=4
&HealthCheckConnectTimeout=100
&HealthCheckConnectPort=80
&healthCheckInterval=3
&healthCheckReq=hello
&healthCheckExp=ok
&VServerGroupId=rsp-cige6j8****
&MasterSlaveServerGroupId=rsp-0bfucwu****
&AclId=123
&AclType=white
&AclStatus=off
&Description=udp_80
&ProxyProtocolV2Enabled=false
&HealthCheckSwitch=on
&<Common request parameters>

Sample responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 InvalidParameterValue.SpecNotSupport The loadBalancer of shared spec does not support the parameter value, %s. The error message returned because shared-resource CLB instances do not support the specified parameters.
400 OperationNotSupport.Acl The cloud box instance does not support acl. The error message returned because you cannot enable access control for an instance connected to a cloud box.
400 InvalidParameterValue.RegionNotSupport The region does not support the parameter value, %s. The error message returned because the specified parameter value is not supported in the current region.
400 Abs.VServerGroupIdAndMasterSlaveServerGroupId.MissMatch The parameters VServerGroupId or MasterSlaveServerGroupId miss match. The error message returned because the VServerGroupId and MasterSlaveServerGroupId parameters conflict with each other.
400 IpVersionConflict The ip version of this LoadBalancer and the Acl is conflict. The error message returned because the specified IP version is not supported by the network ACL.
400 InvalidParameterValue.ZoneNotSupport The zone does not support the parameter value, %s. The error message returned because the specified parameter value is not supported in the current zone.
400 ListenerProcessing A previous configuration of the listener is pending,please try again later. The error message returned because the specified instance is being configured. Try again later.
400 AclNotExist Acl does not exist. The error message returned because the specified network ACL does not exist.
400 InvalidParameter.ListenerPortConflict There is conflict listener port exists. The error message returned because the specified listening port already exists.
400 InvalidParam.VServerGroupId The specified VServerGroupId is invalid. The error message returned because VServerGroupId is set to an invalid value. Specify a valid value and try again.
400 MissingParam.HealthCheckConnectPort The parameter HealthCheckConnectPort is required. The error message returned because HealthCheckConnectPort is not set.
400 InvalidParam.ListenerPort The specified ListenerPort is invalid. The error message returned because ListenerPort is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.StartPort The specified StartPort is invalid. The error message returned because StartPort is set to an invalid value. Specify a valid value and try again.
400 InvalidParamSize.PortRange The size of param PortRange is invalid. The error message returned because PortRange is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.EndPort The specified EndPort is invalid. The error message returned because EndPort is set to an invalid value. Specify a valid value and try again.
400 QuotaLimitExceeds.AclAttachedToListener %s. The error message returned because the number of listeners associated with the network ACL has reached the upper limit.
400 QuotaLimitExceeds.TotalAclEntry %s. The error message returned because the number of network ACL rules has reached the upper limit.
400 Duplicated.AclEntry %s. The error message returned because the specified ACL rule already exists.
400 InvalidParameter.RegionNotSupport The region does not support the parameter: %s. The error message returned because the parameter is not supported in the current region.
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 listeners that use SSL over TCP.
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 listeners that use SSL over TCP.
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.HealthCheckExp The length of the parameter HealthCheckReq is invalid. The error message returned because HealthCheckExp is set to an invalid value. Specify a valid value and try again.
400 InvalidParamLength.HealthCheckReq The length of the parameter HealthCheckReq is invalid. The error message returned because HealthCheckReq is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.HealthCheckReq The param HealthCheckReq is invalid. The error message returned because HealthCheckReq is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.HealthCheckExp The param HealthCheckExp is invalid. The error message returned because HealthCheckExp is set to an invalid value. Specify a valid value and try again.
400 ResourceNotFound.VServerGroup %s. The error message returned because the specified server group does not exist.
400 IllegalParam.FailoverThreshold The parameter FailoverThreshold is illegal. The error message returned because FailoverThreshold is set to an invalid value. Specify a valid value and try again.
400 IllegalParam.FailoverStrategy The parameter FailoverStrategy is illegal. The error message returned because FailoverStrategy is set to an invalid value. Specify a valid value and try again.
400 InvalidParameter.ZoneNotSupport The zone does not support the parameter %s. The error message returned because the specified parameter is not supported in the current zone.
400 MasterSlaveServerConflict The servers are conflict for MasterSlaveGroup. The error message returned because the backend servers in the primary/secondary server group cannot be the same.
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 IllegalParam.HealthCheckType The param of HealthCheckType is illegal. The error message returned because HealthCheckType is set to an invalid value. Specify a valid value and try again.
400 MissingParam.HealthCheckMethod The param of HealthCheckMethod is missing. The error message returned because HealthCheckMethod is not set.
400 IllegalParam.HealthCheckMethod The param of HealthCheckMethod is illegal. The error message returned because HealthCheckMethod is set to an invalid value. Specify a valid value and try again.
400 IllegalParam.HealthCheck The param of HealthCheck is illegal. The error message returned because HealthCheck is set to an invalid value. Specify a valid value and try again.
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 shared-resource CLB instances do not support the FullNatEnabled parameter.

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