edit-icon download-icon

ALIYUN::SLB::Listener

Last Updated: Jun 13, 2018

The ALIYUN::SLB::Listener type is used to create a listener.

Syntax

  1. {
  2. "Type" : "ALIYUN::SLB::Listener",
  3. "Properties" : {
  4. "Protocol" : String,
  5. "HealthCheck" : Map,
  6. "ListenerPort" : Integer,
  7. "Persistence" : Map,
  8. "Bandwidth" : Integer,
  9. "BackendServerPort" : Integer,
  10. "Scheduler" : String,
  11. "LoadBalancerId" : String,
  12. "CACertificateId" : String,
  13. "ServerCertificateId" : String,
  14. "VServerGroupId" : String
  15. }
  16. }

Properties

Name Type Required Update allowed Description Constraint
Protocol string Yes No IP protocol. Value options: http, https, tcp, and udp.
ListenerPort integer Yes No Front-end port used by the Server Load Balancer instance. Value range: [1, 65535].
Bandwidth integer Yes No Peak bandwidth of the listener. Value range: [1, 1000] or -1, unit: Mbps.
For a public instance billed in PayByBandwidth mode, this parameter cannot be set to –1, and the sum of the peak bandwidths assigned to different listeners cannot exceed the bandwidth value specified when the Server Load Balancer instance is created.
For a public instance billed in PayByTraffic mode, this parameter can be set to –1, indicating that no peak bandwidth limit is applied.
BackendServerPort integer Yes No Backend port used by the Server Load Balancer instance. Value range: [1, 65535].
LoadBalancerId string Yes No ID of the Server Load Balancer instance. N/A
HealthCheck map No No Health check setting. N/A
Persistence map No No Persistence related parameter. N/A
Scheduler string No No Scheduling algorithm.
Value options: wrr and wlc.
Default value: wrr.
CACertificateId string No No CA certificate ID. This parameter is only valid for HTTPS. Two-way authentication is adopted if both of the CA certificate and server certificate are uploaded. One-way authentication is adopted if only the server certificate is uploaded.
ServerCertificateId string No No Server certificate ID. This parameter is required and only valid for HTTPS.
VServerGroupId string No No Virtual server group ID. N/A

HealthCheck syntax

  1. "HealthCheck" : {
  2. "Domain" : String,
  3. "Interval" : Integer,
  4. "URI" : String,
  5. "HttpCode" : String,
  6. "HealthyThreshold" : Integer,
  7. "Timeout" : Integer,
  8. "UnhealthyThreshold" : Integer,
  9. "Port" : Integer
  10. }

HealthCheck attributes

Attribute name Type Required Update allowed Description Constraint
Domain string No No Domain used for health check.
Value options: $_ip, custom string, and null.
A custom string consists of 1 to 80 characters and can contain only letters, numbers, hyphens(-) and periods(.).
When this parameter is set to $_ip or null, the Server Load Balancer instance uses the private IP addresses of backend servers as the domain for health check.
Interval integer No No Health check interval. Value range: [1, 5] in seconds.
URI string No No URI used for health check. The value is a string of 1 to 80 characters. It must start with a slash(/) and contain only English letters, numbers, hyphens(-), slashes(/), periods(.), percents(%), question marks(?), pound signs(#), and ampersands(&).
HttpCode string No No HTTP status code for health check.
Multiple HTTP status codes are separated by commas(,).
Value options: http_2xx, http_3xx, http_4xx, and http_5xx.
Default value: http_2xx.
HealthyThreshold integer No No Threshold value used to determine that a health check is successful. This value indicates the number of consecutive successful health checks required to change the health check status of backend servers from “fail” to “success”. Value range: [1, 10]
Timeout integer No No Maximum timeout time for returning a health check response.
Value range: [1, 50], in seconds.
Note: If the value of Timeout is smaller than Interval, Timeout is invalid and the value of Interval is taken as the timeout time.
UnhealthyThreshold integer No No Threshold value used to determine that a health check fails. This value indicates the number of consecutive failed health checks required to change the health check status of backend servers from “success” to “fail”. Value range: [1, 10].
Port integer No No Port used for health check. Value range: [0, 65535].

Persistence syntax

  1. "Persistence" : {
  2. "PersistenceTimeout" : Integer,
  3. "CookieTimeout" : Integer,
  4. "XForwardedFor" : String,
  5. "Cookie" : String,
  6. "StickySession" : String,
  7. "StickySessionType" : String,
  8. }

Persistence attributes

Attribute name Type Required Update allowed Description Constraint
StickySession string Yes No Whether to enable session persistence. Value options: on and off.
PersistenceTimeout integer No No Connection persistence timeout time. Value range: [0, 1000], in seconds.
Default value: 0, indicating that connection persistence is disabled.
CookieTimeout integer No No Cookie timeout.
This parameter must be set when StickySession is “on” and StickySessionType is “insert”. In other cases, this parameter is ignored.
Value range: [1, 86400], in seconds.
XForwardedFor string No No Whether to use the X-Forwarded-For record to obtain a visitor’s real IP address.
Value options: on and off.
Default value: on
Cookie string No No Cookie configured on the server.
This parameter must be set when StickySession is “on” and StickySessionType is “server”. In other cases, this parameter is ignored.
The parameter value is a string of 1 to 200 characters and follows the RFC 2965 standard.
It can contain only ASCII English letters and numbers. It cannot contain commas(,), semicolons(;), or spaces, and cannot start with a dollar sign($).
StickySessionType string No No Cookie processing method.
This parameter must be set when StickySession is set to “on”. When StickySession is “off”, this parameter is ignored.
Value options: insert and server. “insert” indicates insertion by the Server Load Balancer instance.
“server” indicates learning by the Server Load Balancer instance from backend servers.

Return values

Fn::GetAtt

  • LoadBalancerId: Unique ID of the Server Load Balancer instance.

  • ListenerPortsAndProtocol: Front-end ports and protocol of the Server Load Balancer instance, in array format.

Example

  1. {
  2. "ROSTemplateFormatVersion": "2015-09-01",
  3. "Resources": {
  4. "LoadBalancer": {
  5. "Type": "ALIYUN::SLB::LoadBalancer",
  6. "Properties": {
  7. "LoadBalancerName": "createdByHeat",
  8. "AddressType": "internet",
  9. "InternetChargeType": "paybybandwidth"
  10. }
  11. },
  12. "CreateListener": {
  13. "Type": "ALIYUN::SLB::Listener",
  14. "Properties": {
  15. "LoadBalancerId": {"Ref": "LoadBalancer"},
  16. "ListenerPort": "8094",
  17. "BackendServerPort": 8080,
  18. "Bandwidth": 1,
  19. "Protocol": "http",
  20. "HealthCheck": {
  21. "HealthyThreshold": 3,
  22. "UnhealthyThreshold": 3,
  23. "Interval": 2,
  24. "Timeout": 5,
  25. "HttpCode": "http_2xx,http_3xx,http_4xx,http_5xx"
  26. },
  27. "Scheduler": "wrr",
  28. "Persistence": {
  29. "PersistenceTimeout": 1,
  30. "XForwardedFor": 1,
  31. "StickySession": 1,
  32. "StickySessionType": 1,
  33. "CookieTimeout": 0,
  34. "Cookie": 1
  35. }
  36. }
  37. }
  38. },
  39. "Outputs": {
  40. "LoadBalanceDetails": {
  41. "Value" : {"Fn::GetAtt": ["LoadBalancer", "LoadBalancerId"]}
  42. }
  43. }
  44. }
Thank you! We've received your feedback.