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:
|
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:
|
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