ALIYUN::GA::Listener is used to create a Listener.

Syntax

{
  "Type": "ALIYUN::GA::Listener",
  "Properties": {
    "Description": String,
    "PortRanges": List,
    "Protocol": String,
    "AcceleratorId": String,
    "Name": String,
    "ClientAffinity": String
  }
}

Properties

Property Type Required Editable Description Constraint
Description String No Yes The description of the listener. None
PortRanges List Yes Yes The listening port. Supports up to 10 listening ports.

For more information, see PortRanges properties.

Protocol String Yes Yes The network transmission protocol of the listener. Valid values:
  • tcp
  • udp
AcceleratorId String Yes No The ID of the GA instance. None
Name String No Yes The name of the listener. The name must be 2 to 128 characters in length And can contain letters, digits, underscores (_), and hyphens (-).
ClientAffinity String No Yes Indicates whether client affinity is enabled for the listener. Valid values:
  • None: dislinks the affinity between clients and does not ensure that connection requests from the same client are always directed to the same endpoint.
  • SOURCE_IP: maintains client affinity. When a client accesses a stateful application, it can direct all requests from the same client to the same endpoint, regardless of the source port and protocol.

PortRanges syntax

"PortRanges": [
  {
    "FromPort": Integer,
    "ToPort": Integer
  }
]

PortRanges properties

Property Type Required Editable Description Constraint
FromPort Integer Yes Yes The first listening port of the port range specified for receiving and forwarding requests to endpoints. None
ToPort Integer Yes Yes The last listening port of the port range specified for receiving and forwarding requests to endpoints. None

Response parameters

Fn::GetAtt

ListenerId: the ID of the listener.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Description": {
      "Type": "String",
      "Description": "The description of the listener."
    },
    "PortRanges": {
      "Type": "Json",
      "Description": "",
      "MinLength": 1,
      "MaxLength": 10
    },
    "Protocol": {
      "Type": "String",
      "Description": "The network transmission protocol of the listener. Valid values:\ntcp: TCP protocol\nudp: UDP protocol",
      "AllowedValues": [
        "tcp",
        "udp"
      ]
    },
    "AcceleratorId": {
      "Type": "String",
      "Description": "The ID of the Global Accelerator instance to which the listener will be added."
    },
    "Name": {
      "Type": "String",
      "Description": "The name of the listener.\nThe name must be 2 to 128 characters in length and can contain letters, digits, underscores\n(_), and hyphens (-). It must start with a letter or Chinese character."
    },
    "ClientAffinity": {
      "Type": "String",
      "Description": "Specifies whether to enable client affinity for the listener.\nIf you do not specify the default value in the parameter, client affinity is disabled.\nWhen client affinity is disabled, the connections from a specific source (client)\nIP address are not always routed to the same endpoint.\nIf you set the value to SOURCE_IP, client affinity is enabled. When client affinity is enabled, the connections from\na specific source (client) IP address are always routed to the same endpoint.",
      "AllowedValues": [
        "NONE",
        "SOURCE_IP"
      ]
    }
  },
  "Resources": {
    "Listener": {
      "Type": "ALIYUN::GA::Listener",
      "Properties": {
        "Description": {
          "Ref": "Description"
        },
        "PortRanges": {
          "Ref": "PortRanges"
        },
        "Protocol": {
          "Ref": "Protocol"
        },
        "AcceleratorId": {
          "Ref": "AcceleratorId"
        },
        "Name": {
          "Ref": "Name"
        },
        "ClientAffinity": {
          "Ref": "ClientAffinity"
        }
      }
    }
  },
  "Outputs": {
    "ListenerId": {
      "Description": "The ID of the listener.",
      "Value": {
        "Fn::GetAtt": [
          "Listener",
          "ListenerId"
        ]
      }
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Description:
    Type: String
    Description: The description of the listener.
  PortRanges:
    Type: Json
    Description: ''
    MinLength: 1
    MaxLength: 10
  Protocol:
    Type: String
    Description: |-
      The network transmission protocol of the listener. Valid values:
      tcp: TCP protocol
      udp: UDP protocol
    AllowedValues:
      -tcp
      -udp
  AcceleratorId:
    Type: String
    Description: >-
      The ID of the Global Accelerator instance to which the listener will be
      added.
  Name:
    Type: String
    Description: >-
      The name of the listener.

      The name must be 2 to 128 characters in length and can contain letters,
      digits, underscores

      (_), and hyphens (-). It must start with a letter or Chinese character.
  ClientAffinity:
    Type: String
    Description: >-
      Specifies whether to enable client affinity for the listener.

      If you do not specify the default value in the parameter, client affinity
      is disabled.

      When client affinity is disabled and the connections from a specific source
      (client)

      IP address are not always routed to the same endpoint.

      If you set the value to SOURCE_IP, client affinity is enabled. When client
      affinity is enabled and the connections from

      a specific source (client) IP address are always routed to the same
      endpoint.
    AllowedValues:
      -NONE
      -SOURCE_IP
Resources:
  Listener:
    Type: 'ALIYUN::GA::Listener'
    Properties:
      Description:
        Ref: Description
      PortRanges:
        Ref: PortRanges
      Protocol:
        Ref: Protocol
      AcceleratorId:
        Ref: AcceleratorId
      Name:
        Ref: Name
      ClientAffinity:
        Ref: ClientAffinity
Outputs:
  ListenerId:
    Description: The ID of the listener.
    Value:
      'Fn::GetAtt':
        -Listener
        -ListenerId