语法
{
"Type": "ALIYUN::SLB::Rule",
"Properties": {
"ListenerPort": Integer,
"RuleList": List,
"LoadBalancerId": String,
"ListenerProtocol": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
ListenerPort | Integer | 是 | 否 | 负载均衡实例前端使用的监听端口。 | 取值范围:1~65535。 |
RuleList | List | 是 | 否 | 要添加的转发规则。 | 一次请求中,最多可添加10条转发规则。 每条转发规则包含以下参数: RuleName Domain Url VServerGroupId
Domain和URL两者必须指定一个,也可以同时指定。
说明 Domain和URL的组合在同一个监听内必须唯一。 |
LoadBalancerId | String | 是 | 否 | 负载均衡实例ID。 | 无 |
ListenerProtocol | String | 否 | 否 | 实例前端使用的协议。 | 无 |
RuleList语法
"RuleList": [
{
"Url": String,
"Domain": String,
"VServerGroupId": String,
"RuleName": String
}
]
RuleList属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
Url | String | 否 | 否 | 访问路径。 | |
Domain | String | 否 | 否 | 转发规则关联的请求域名。 | 无 |
VServerGroupId | String | 是 | 否 | 该转发规则的目标虚拟服务器组ID。 | 无 |
RuleName | String | 是 | 否 | 转发规则名称。 | 长度为1~40个字符,可包含字母、数字和以下特殊字符: -/._ 。
同一个监听内不同规则的名称必须唯一。 |
返回值
Fn::GetAtt
Rules:转发规则列表。
示例
YAML示例
ROSTemplateFormatVersion: '2015-09-01'
Resources:
Rule:
Type: ALIYUN::SLB::Rule
Properties:
ListenerPort:
Ref: ListenerPort
RuleList:
Fn::Split:
- ','
- Ref: RuleList
- Ref: RuleList
LoadBalancerId:
Ref: LoadBalancerId
Parameters:
ListenerPort:
Type: Number
Description: |-
The front-end HTTPS listener port of the Server Load Balancer instance. Valid value:
1-65535
MaxValue: 65535
MinValue: 1
RuleList:
MinLength: 1
Type: CommaDelimitedList
Description: The forwarding rules to add.
MaxLength: 10
LoadBalancerId:
Type: String
Description: The ID of Server Load Balancer instance.
Outputs:
Rules:
Description: A list of forwarding rules. Each element of rules contains "RuleId".
Value:
Fn::GetAtt:
- Rule
- Rules
JSON示例
{
"ROSTemplateFormatVersion": "2015-09-01",
"Resources": {
"Rule": {
"Type": "ALIYUN::SLB::Rule",
"Properties": {
"ListenerPort": {
"Ref": "ListenerPort"
},
"RuleList": {
"Fn::Split": [",", {
"Ref": "RuleList"
}, {
"Ref": "RuleList"
}]
},
"LoadBalancerId": {
"Ref": "LoadBalancerId"
}
}
}
},
"Parameters": {
"ListenerPort": {
"Type": "Number",
"Description": "The front-end HTTPS listener port of the Server Load Balancer instance. Valid value:\n1-65535",
"MaxValue": 65535,
"MinValue": 1
},
"RuleList": {
"MinLength": 1,
"Type": "CommaDelimitedList",
"Description": "The forwarding rules to add.",
"MaxLength": 10
},
"LoadBalancerId": {
"Type": "String",
"Description": "The ID of Server Load Balancer instance."
}
},
"Outputs": {
"Rules": {
"Description": "A list of forwarding rules. Each element of rules contains \"RuleId\".",
"Value": {
"Fn::GetAtt": ["Rule", "Rules"]
}
}
}
}