ALIYUN::GA::Listener类型用于创建监听。
语法
{
"Type": "ALIYUN::GA::Listener",
"Properties": {
"Description": String,
"PortRanges": List,
"Protocol": String,
"AcceleratorId": String,
"Name": String,
"ClientAffinity": String,
"Certificates": List,
"SecurityPolicyId": String,
"ProxyProtocol": Boolean,
"XForwardedForConfig": Map,
"RequestTimeout": Integer,
"IdleTimeout": Integer,
"HttpVersion": String,
"Type": String
}
}
属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
AcceleratorId |
String |
是 |
否 |
全球加速实例ID。 |
无 |
|
PortRanges |
List |
是 |
是 |
监听端口。 |
最多支持10个监听端口。 详情请参见PortRanges属性。 |
|
Protocol |
String |
是 |
是 |
监听的网络传输协议类型。 |
取值:
|
|
Certificates |
List |
否 |
是 |
SSL证书。 |
更多信息,请参见Certificates属性。 |
|
ClientAffinity |
String |
否 |
是 |
客户端亲和性。 |
取值:
|
|
Description |
String |
否 |
是 |
监听的描述信息。 |
无 |
|
HttpVersion |
String |
否 |
是 |
HTTP 协议的最大版本 |
取值:
说明
仅 HTTPS 监听支持此参数。 |
|
IdleTimeout |
Integer |
否 |
是 |
连接空闲超时时间。 |
单位:秒。
|
|
Name |
String |
否 |
是 |
监听的名称。 |
长度为2~128个字符。以英文字母或汉字开头,可包含英文字母、汉字、数字、下划线(_)和短划线(-)。 |
|
ProxyProtocol |
Boolean |
否 |
是 |
是否开启保持客户端源IP功能。 |
取值:
说明
该参数后续将不在监听API中配置,建议在终端节点组的相关API中进行配置。 关于ProxyProtocol的更多信息,请参见CreateEndpointGroup和UpdateEndpointGroup。 |
|
RequestTimeout |
Integer |
否 |
是 |
弹性网卡的私网 IP 地址。 |
单位:秒。 可选:1-180 秒,默认 60s。 说明
仅对 Protocol(网络传输协议类型)为 HTTP 或 HTTPS 的监听有效。如果在超时时间内后端服务器一直没有响应,全球加速将放弃等待,并给客户端返回 HTTP 504 错误码。 |
|
SecurityPolicyId |
String |
否 |
是 |
安全策略实例ID。 |
取值:
说明
仅HTTPS监听支持此参数。 |
|
Type |
String |
否 |
否 |
监听的路由类型。 |
取值:
说明
|
|
XForwardedForConfig |
Map |
否 |
是 |
XForward字段配置信息。 |
更多信息,请参见XForwardedForConfig属性。 |
Certificates语法
"Certificates": [
{
"Id": String
}
]
Certificates属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Id |
String |
是 |
是 |
SSL证书ID。 |
说明
仅HTTPS协议的监听需要配置该参数。 |
XForwardedForConfig语法
"XForwardedForConfig": {
"XRealIpEnabled": Boolean,
"XForwardedForGaIdEnabled": Boolean,
"XForwardedForGaApEnabled": Boolean,
"XForwardedForPortEnabled": Boolean,
"XForwardedForProtoEnabled": Boolean
}
XForwardedForConfig属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
XForwardedForGaApEnabled |
Boolean |
否 |
是 |
是否通过GA-AP字段获取加速地域信息。 |
取值:
说明
仅HTTP和HTTPS监听支持此参数。 |
|
XForwardedForGaIdEnabled |
Boolean |
否 |
是 |
是否通过GA-ID头字段获取全球加速实例ID。 |
取值:
说明
仅HTTP和HTTPS监听支持此参数。 |
|
XForwardedForPortEnabled |
Boolean |
否 |
是 |
是否通过GA-X-Forward-Port字段获取全球加速实例的监听端口。 |
取值:
说明
仅HTTP和HTTPS监听支持此参数。 |
|
XForwardedForProtoEnabled |
Boolean |
否 |
是 |
是否通过GA-X-Forward-Proto字段获取全球加速实例的监听协议。 |
取值:
说明
仅HTTP和HTTPS监听支持此参数。 |
|
XRealIpEnabled |
Boolean |
否 |
是 |
是否通过X-Real-IP字段获取真实的客户端IP。 |
取值:
说明
仅HTTP和HTTPS监听支持此参数。 |
PortRanges语法
"PortRanges": [
{
"FromPort": Integer,
"ToPort": Integer
}
]
PortRanges属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
FromPort |
Integer |
是 |
是 |
用来接收请求并向终端节点进行转发的起始监听端口。 |
无 |
|
ToPort |
Integer |
是 |
是 |
用来接收请求并向终端节点进行转发的结束监听端口。 |
无 |
返回值
Fn::GetAtt
ListenerId:监听ID。
示例
场景 1 :为全球加速实例创建TCP监听,用于四层协议加速。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 为全球加速实例创建TCP监听,用于四层协议加速。
en: Create a TCP listener for a GA instance for Layer-4 acceleration.
Parameters:
AcceleratorId:
Type: String
Label:
zh-cn: 全球加速实例ID
en: Accelerator ID
Description:
zh-cn: 已有的全球加速实例ID。
en: The ID of an existing Global Accelerator instance.
ListenerName:
Type: String
Label:
zh-cn: 监听名称
en: Listener Name
Description:
zh-cn: >-
监听器的名称,2~128个字符,
以字母或汉字开头。
en: >-
Listener name, 2-128 characters,
starting with a letter or Chinese character.
Default: tcp-listener
FromPort:
Type: Number
Label:
zh-cn: 起始监听端口
en: From Port
Description:
zh-cn: 监听端口范围的起始端口。
en: The start port of the listening port range.
Default: 9000
MinValue: 1
MaxValue: 65499
ToPort:
Type: Number
Label:
zh-cn: 结束监听端口
en: To Port
Description:
zh-cn: 监听端口范围的结束端口,与起始端口相同时表示监听单个端口。
en: The end port of the listening port range. Same as from-port for a single port.
Default: 9000
MinValue: 1
MaxValue: 65499
Resources:
Listener:
Type: ALIYUN::GA::Listener
Properties:
AcceleratorId:
Ref: AcceleratorId
Name:
Ref: ListenerName
Protocol: tcp
PortRanges:
- FromPort:
Ref: FromPort
ToPort:
Ref: ToPort
ClientAffinity: SOURCE_IP
Outputs:
ListenerId:
Label:
zh-cn: 监听ID
en: Listener ID
Description:
zh-cn: 创建成功的监听器唯一标识。
en: The unique identifier of the created listener.
Value:
Fn::GetAtt:
- Listener
- ListenerId{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "为全球加速实例创建TCP监听,用于四层协议加速。",
"en": "Create a TCP listener for a GA instance for Layer-4 acceleration."
},
"Parameters": {
"AcceleratorId": {
"Type": "String",
"Label": {
"zh-cn": "全球加速实例ID",
"en": "Accelerator ID"
},
"Description": {
"zh-cn": "已有的全球加速实例ID。",
"en": "The ID of an existing Global Accelerator instance."
}
},
"ListenerName": {
"Type": "String",
"Label": {
"zh-cn": "监听名称",
"en": "Listener Name"
},
"Description": {
"zh-cn": "监听器的名称,2~128个字符,以字母或汉字开头。",
"en": "Listener name, 2-128 characters, starting with a letter or Chinese character."
},
"Default": "tcp-listener"
},
"FromPort": {
"Type": "Number",
"Label": {
"zh-cn": "起始监听端口",
"en": "From Port"
},
"Description": {
"zh-cn": "监听端口范围的起始端口。",
"en": "The start port of the listening port range."
},
"Default": 9000,
"MinValue": 1,
"MaxValue": 65499
},
"ToPort": {
"Type": "Number",
"Label": {
"zh-cn": "结束监听端口",
"en": "To Port"
},
"Description": {
"zh-cn": "监听端口范围的结束端口,与起始端口相同时表示监听单个端口。",
"en": "The end port of the listening port range. Same as from-port for a single port."
},
"Default": 9000,
"MinValue": 1,
"MaxValue": 65499
}
},
"Resources": {
"Listener": {
"Type": "ALIYUN::GA::Listener",
"Properties": {
"AcceleratorId": {
"Ref": "AcceleratorId"
},
"Name": {
"Ref": "ListenerName"
},
"Protocol": "tcp",
"PortRanges": [
{
"FromPort": {
"Ref": "FromPort"
},
"ToPort": {
"Ref": "ToPort"
}
}
],
"ClientAffinity": "SOURCE_IP"
}
}
},
"Outputs": {
"ListenerId": {
"Label": {
"zh-cn": "监听ID",
"en": "Listener ID"
},
"Description": {
"zh-cn": "创建成功的监听器唯一标识。",
"en": "The unique identifier of the created listener."
},
"Value": {
"Fn::GetAtt": [
"Listener",
"ListenerId"
]
}
}
}
}场景 2 :创建HTTP监听并配置XForwardedFor头,获取客户端真实IP和加速信息。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建HTTP监听并配置XForwardedFor头,获取客户端真实IP和加速信息。
en: Create an HTTP listener with XForwardedFor config for client IP and GA info.
Parameters:
AcceleratorId:
Type: String
Label:
zh-cn: 全球加速实例ID
en: Accelerator ID
Description:
zh-cn: 已有的全球加速实例ID。
en: The ID of an existing Global Accelerator instance.
ListenerName:
Type: String
Label:
zh-cn: 监听名称
en: Listener Name
Description:
zh-cn: 监听器的名称。
en: The name of the listener.
Default: http-listener
Resources:
Listener:
Type: ALIYUN::GA::Listener
Properties:
AcceleratorId:
Ref: AcceleratorId
Name:
Ref: ListenerName
Description: HTTP监听,启用XForwardedFor获取客户端和加速信息
Protocol: http
PortRanges:
- FromPort: 80
ToPort: 80
- FromPort: 8080
ToPort: 8080
ClientAffinity: NONE
XForwardedForConfig:
XRealIpEnabled: true
XForwardedForGaIdEnabled: true
XForwardedForGaApEnabled: true
XForwardedForPortEnabled: true
XForwardedForProtoEnabled: true
Outputs:
ListenerId:
Label:
zh-cn: 监听ID
en: Listener ID
Description:
zh-cn: 创建成功的HTTP监听器唯一标识。
en: The unique identifier of the created HTTP listener.
Value:
Fn::GetAtt:
- Listener
- ListenerId{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建HTTP监听并配置XForwardedFor头,获取客户端真实IP和加速信息。",
"en": "Create an HTTP listener with XForwardedFor config for client IP and GA info."
},
"Parameters": {
"AcceleratorId": {
"Type": "String",
"Label": {
"zh-cn": "全球加速实例ID",
"en": "Accelerator ID"
},
"Description": {
"zh-cn": "已有的全球加速实例ID。",
"en": "The ID of an existing Global Accelerator instance."
}
},
"ListenerName": {
"Type": "String",
"Label": {
"zh-cn": "监听名称",
"en": "Listener Name"
},
"Description": {
"zh-cn": "监听器的名称。",
"en": "The name of the listener."
},
"Default": "http-listener"
}
},
"Resources": {
"Listener": {
"Type": "ALIYUN::GA::Listener",
"Properties": {
"AcceleratorId": {
"Ref": "AcceleratorId"
},
"Name": {
"Ref": "ListenerName"
},
"Description": "HTTP监听,启用XForwardedFor获取客户端和加速信息",
"Protocol": "http",
"PortRanges": [
{
"FromPort": 80,
"ToPort": 80
},
{
"FromPort": 8080,
"ToPort": 8080
}
],
"ClientAffinity": "NONE",
"XForwardedForConfig": {
"XRealIpEnabled": true,
"XForwardedForGaIdEnabled": true,
"XForwardedForGaApEnabled": true,
"XForwardedForPortEnabled": true,
"XForwardedForProtoEnabled": true
}
}
}
},
"Outputs": {
"ListenerId": {
"Label": {
"zh-cn": "监听ID",
"en": "Listener ID"
},
"Description": {
"zh-cn": "创建成功的HTTP监听器唯一标识。",
"en": "The unique identifier of the created HTTP listener."
},
"Value": {
"Fn::GetAtt": [
"Listener",
"ListenerId"
]
}
}
}
}场景 3 :创建HTTPS监听并配置SSL证书和TLS安全策略,实现安全的全球加速。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建HTTPS监听并配置SSL证书和TLS安全策略,实现安全的全球加速。
en: Create an HTTPS listener with SSL certificate and TLS security policy.
Parameters:
AcceleratorId:
Type: String
Label:
zh-cn: 全球加速实例ID
en: Accelerator ID
Description:
zh-cn: 已有的全球加速实例ID。
en: The ID of an existing Global Accelerator instance.
ListenerName:
Type: String
Label:
zh-cn: 监听名称
en: Listener Name
Description:
zh-cn: HTTPS监听器的名称。
en: The name of the HTTPS listener.
Default: https-listener
CertificateId:
Type: String
Label:
zh-cn: SSL证书ID
en: SSL Certificate ID
Description:
zh-cn: >-
SSL证书的唯一标识,可在SSL证书服务控制台获取。
证书需与加速域名匹配。
en: >-
The SSL certificate ID, available in the SSL Certificates Service console.
The certificate must match the accelerated domain.
SecurityPolicyId:
Type: String
Label:
zh-cn: TLS安全策略
en: TLS Security Policy
Description:
zh-cn: >-
TLS安全策略,决定支持的TLS版本和加密算法套件。
tls_cipher_policy_1_2_strict_with_1_3:TLSv1.2+1.3,最高安全性(推荐)。
tls_cipher_policy_1_2_strict:仅TLSv1.2严格模式。
tls_cipher_policy_1_2:TLSv1.2标准模式。
tls_cipher_policy_1_0:TLSv1.0+1.1+1.2,兼容性最佳。
en: >-
TLS security policy controlling supported TLS versions and cipher suites.
tls_cipher_policy_1_2_strict_with_1_3: TLSv1.2+1.3, highest security (recommended).
Default: tls_cipher_policy_1_2_strict_with_1_3
AllowedValues:
- tls_cipher_policy_1_2_strict_with_1_3
- tls_cipher_policy_1_2_strict
- tls_cipher_policy_1_2
- tls_cipher_policy_1_1
- tls_cipher_policy_1_0
ClientAffinity:
Type: String
Label:
zh-cn: 客户端亲和性
en: Client Affinity
Description:
zh-cn: >-
SOURCE_IP:保持客户端亲和性,来自同一客户端的请求始终转发到同一终端节点。
NONE:不保持亲和性,请求可能转发到不同终端节点。
en: >-
SOURCE_IP: maintain client affinity, same client always goes to same endpoint.
NONE: no affinity, requests may go to different endpoints.
Default: SOURCE_IP
AllowedValues:
- SOURCE_IP
- NONE
Resources:
Listener:
Type: ALIYUN::GA::Listener
Properties:
AcceleratorId:
Ref: AcceleratorId
Name:
Ref: ListenerName
Description: HTTPS安全监听,配置SSL证书和TLS安全策略
Protocol: https
PortRanges:
- FromPort: 443
ToPort: 443
ClientAffinity:
Ref: ClientAffinity
Certificates:
- Id:
Ref: CertificateId
SecurityPolicyId:
Ref: SecurityPolicyId
XForwardedForConfig:
XRealIpEnabled: true
XForwardedForGaIdEnabled: true
XForwardedForGaApEnabled: false
XForwardedForPortEnabled: true
XForwardedForProtoEnabled: true
Outputs:
ListenerId:
Label:
zh-cn: 监听ID
en: Listener ID
Description:
zh-cn: 创建成功的HTTPS监听器唯一标识。
en: The unique identifier of the created HTTPS listener.
Value:
Fn::GetAtt:
- Listener
- ListenerId{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建HTTPS监听并配置SSL证书和TLS安全策略,实现安全的全球加速。",
"en": "Create an HTTPS listener with SSL certificate and TLS security policy."
},
"Parameters": {
"AcceleratorId": {
"Type": "String",
"Label": {
"zh-cn": "全球加速实例ID",
"en": "Accelerator ID"
},
"Description": {
"zh-cn": "已有的全球加速实例ID。",
"en": "The ID of an existing Global Accelerator instance."
}
},
"ListenerName": {
"Type": "String",
"Label": {
"zh-cn": "监听名称",
"en": "Listener Name"
},
"Description": {
"zh-cn": "HTTPS监听器的名称。",
"en": "The name of the HTTPS listener."
},
"Default": "https-listener"
},
"CertificateId": {
"Type": "String",
"Label": {
"zh-cn": "SSL证书ID",
"en": "SSL Certificate ID"
},
"Description": {
"zh-cn": "SSL证书的唯一标识,可在SSL证书服务控制台获取。证书需与加速域名匹配。",
"en": "The SSL certificate ID, available in the SSL Certificates Service console. The certificate must match the accelerated domain."
}
},
"SecurityPolicyId": {
"Type": "String",
"Label": {
"zh-cn": "TLS安全策略",
"en": "TLS Security Policy"
},
"Description": {
"zh-cn": "TLS安全策略,决定支持的TLS版本和加密算法套件。tls_cipher_policy_1_2_strict_with_1_3:TLSv1.2+1.3,最高安全性(推荐)。tls_cipher_policy_1_2_strict:仅TLSv1.2严格模式。tls_cipher_policy_1_2:TLSv1.2标准模式。tls_cipher_policy_1_0:TLSv1.0+1.1+1.2,兼容性最佳。",
"en": "TLS security policy controlling supported TLS versions and cipher suites. tls_cipher_policy_1_2_strict_with_1_3: TLSv1.2+1.3, highest security (recommended)."
},
"Default": "tls_cipher_policy_1_2_strict_with_1_3",
"AllowedValues": [
"tls_cipher_policy_1_2_strict_with_1_3",
"tls_cipher_policy_1_2_strict",
"tls_cipher_policy_1_2",
"tls_cipher_policy_1_1",
"tls_cipher_policy_1_0"
]
},
"ClientAffinity": {
"Type": "String",
"Label": {
"zh-cn": "客户端亲和性",
"en": "Client Affinity"
},
"Description": {
"zh-cn": "SOURCE_IP:保持客户端亲和性,来自同一客户端的请求始终转发到同一终端节点。NONE:不保持亲和性,请求可能转发到不同终端节点。",
"en": "SOURCE_IP: maintain client affinity, same client always goes to same endpoint. NONE: no affinity, requests may go to different endpoints."
},
"Default": "SOURCE_IP",
"AllowedValues": [
"SOURCE_IP",
"NONE"
]
}
},
"Resources": {
"Listener": {
"Type": "ALIYUN::GA::Listener",
"Properties": {
"AcceleratorId": {
"Ref": "AcceleratorId"
},
"Name": {
"Ref": "ListenerName"
},
"Description": "HTTPS安全监听,配置SSL证书和TLS安全策略",
"Protocol": "https",
"PortRanges": [
{
"FromPort": 443,
"ToPort": 443
}
],
"ClientAffinity": {
"Ref": "ClientAffinity"
},
"Certificates": [
{
"Id": {
"Ref": "CertificateId"
}
}
],
"SecurityPolicyId": {
"Ref": "SecurityPolicyId"
},
"XForwardedForConfig": {
"XRealIpEnabled": true,
"XForwardedForGaIdEnabled": true,
"XForwardedForGaApEnabled": false,
"XForwardedForPortEnabled": true,
"XForwardedForProtoEnabled": true
}
}
}
},
"Outputs": {
"ListenerId": {
"Label": {
"zh-cn": "监听ID",
"en": "Listener ID"
},
"Description": {
"zh-cn": "创建成功的HTTPS监听器唯一标识。",
"en": "The unique identifier of the created HTTPS listener."
},
"Value": {
"Fn::GetAtt": [
"Listener",
"ListenerId"
]
}
}
}
}