edit-icon download-icon

CreateLoadBalancerUDPListener

Last Updated: Apr 18, 2018

Description

Create a UDP protocol listener.

Note the following before using the API to create a UDP listener:

  • The health check function is enabled by default for UDP Listeners and cannot be disabled.

  • For Layer-4 Server Load Balancer, you can directly get the real IP of the client. However, the client's real IP cannot be obtained if the network type of the SLB instance is classic.

  • After the listener is created, the listener status is stopped. Call the StartLoadBalancerListener API to start the listener to distribute traffic.

Request Parameter

Name Type Required Description
Action String Yes

The action to perform. Valid value:

CreateLoadBalancerUDPListener

RegionId String Yes The ID of the region where the SLB instance is located.
LoadBalancerId String Yes The ID of the SLB instance for which the TCP listener is created.
ListenerPort Integer Yes

The front-end port of the listener that is used to receive incoming traffic and distribute the traffic to the backend servers.

Valid value: [1, 65535]

BackendServerPort Integer No

The port opened on the backend server to receive requests.

Valid value: [1, 65535]

Note: If the VServerGroupId parameter is not specified, this parameter is required.

Bandwidth Integer No

The peak bandwidth of the listener. Valid value: [1,1000] Mbps

Note: Set it to -1 if the Internet SLB instance is charged by traffic.

Scheduler String No

The algorithm used to distribute traffic. Valid value:

  • wrr (Default)

    Backend servers with higher weights receive more requests than those with smaller weights.

  • wlc

    A server with a higher weight will receive a larger percentage of live connections at any one time. If the weights are the same, the system directs network connections to the server with the fewest established connections.

  • rr

    Requests are evenly and sequentially distributed to the backend servers.

VServerGroupId String No

The ID of a VServer group.

The VServerGroupId parameter and the MasterSlaveServerGroupId parameter cannot be used at the same time.

MasterSlaveServerGroupId String No

The ID of a master-slave server group.

The VServerGroupId parameter and the MasterSlaveServerGroupId parameter cannot be used at the same time.

AclStatus String No

Specify whether to enable the access control function.

Valid value: on | off (Default)

AclType String No

Select an access control method after enabling the access control function:

  • whitelist: Only requests from IP addresses or CIDR blocks in the selected access control lists are forwarded. It applies to scenarios where the application only allows access from some specific IP addresses.

    Enabling whitelist poses some business risks. If you enable the whitelist without adding any IP entry in the corresponding access control list, no requests are forwarded.

  • blacklist: Requests from IP addresses or CIDR blocks in the selected access control lists are not forwarded. It applies to scenarios where the application only denies access from some specific IP addresses.

    If you enable a blacklist without adding any IP entry in the corresponding access control list, all requests are forwarded.

This parameter is required if the value of the AclStatus parameter is on.

AclId String No

Select an access control list as the whitelist or the blacklist. For more information, see Configure an access control list.

This parameter is required if the value of the AclStatus parameter is on.

HealthCheckConnectPort Integer No

The port used for health check.

Valid value: [1, 65535]

HealthyThreshold Integer No

The number of consecutive successes of health check performed by the same LVS mode server on the same ECS instance (from failure to success).

Valid value: [2,10]

UnhealthyThreshold Integer No

The number of consecutive failures of health check performed by the same LVS node server on the same ECS instance (from success to failure).

Valid value: [2,10]

HealthCheckConnectTimeout Integer No

The amount of time in seconds to wait for the response from a health check. If an ECS instance sends no response within the specified timeout period, the health check fails.

Valid value: [1,300]

Note: If the value of the HealthCheckInterval is greater than the value of the HealthCHeckTimeout parameter, the timeout is set to the value of the HealthCheckInterval parameter.

HealthCheckInterval Integer No

The time interval between two consecutive health checks.

Valid value: [1,50]

HealthCheckReq String No Request string for UDP listener health check. Only English letters, digits are allowed. Up to 500 characters can be entered.
HealthCheckExp String No Response string for UDP listener check. Only English letters, digits are allowed. Up to 500 characters can be entered.

Response parameter

Name Type Description
RequestId String The ID of the request.

Example

Request example

  1. https://slb.aliyuncs.com/?Action=CreateLoadBalancerUDPListener
  2. &LoadBalancerId=139a00604ad-cn-east-hangzhou-01
  3. &ListenerPort=53
  4. &BackendServerPort=53
  5. &Bandwidth=-1
  6. &VServerGroupId=rsp-cige6j5e7p
  7. &<public request parameters>

Response Example

  • XML format

    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <CreateLoadBalancerUDPListenerResponse>
    3. <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
    4. </CreateLoadBalancerUDPListenerResponse>
  • JSON format

    1. {
    2. "RequestId":" CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
    3. }
Thank you! We've received your feedback.