-
Notifications
You must be signed in to change notification settings - Fork 35
/
nlb-4-layer-load-balancing.yml
97 lines (97 loc) · 2.74 KB
/
nlb-4-layer-load-balancing.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建NLB服务器组,配置两台ECS实例的TCP负载均衡,监听80端口,提供健康检查与自动权重管理,输出NLB DNS名称。
en: Create an NLB server group, configure TCP load balancing for two ECS instances,
with the listener set on port 80, enabling health checks and automatic weight
management, and output the NLB DNS name.
Parameters:
LoadBalancerId:
Type: String
Label:
en: NLB Instance ID
zh-cn: NLB实例ID
AssociationProperty: ALIYUN::NLB::LoadBalancer::LoadBalancerId
EcsInstanceIds:
Type: CommaDelimitedList
Label:
en: ECS Instance ID List
zh-cn: ECS实例ID列表
Description:
en: The ECS instance where the application service has been deployed, <span
style="background:#E7E9EB;"><b>the ECS instance and the NLB instance need
to be under the same VPC</b></span>.
zh-cn: 已部署应用服务的ECS实例,<span style="background:#E7E9EB;"><b>ECS实例和NLB实例需要在同一个VPC下</b></span>。
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
MinLength: 2
MaxLength: 2
Resources:
DS_LoadBalancers:
Type: DATASOURCE::NLB::LoadBalancers
Properties:
LoadBalancerIds:
- Ref: LoadBalancerId
ServerGroup:
Type: ALIYUN::NLB::ServerGroup
Properties:
VpcId:
Fn::Jq:
- First
- .[0].VpcId
- Fn::GetAtt:
- DS_LoadBalancers
- LoadBalancers
ServerGroupType: Instance
Protocol: TCP
ServerGroupName: TrialTutorial
Scheduler: Wrr
Servers:
- ServerType: Ecs
ServerId:
Fn::Select:
- 0
- Ref: EcsInstanceIds
Port: 80
Weight: 100
- ServerType: Ecs
ServerId:
Fn::Select:
- 1
- Ref: EcsInstanceIds
Port: 80
Weight: 100
HealthCheckConfig:
HttpCheckMethod: GET
HealthCheckType: Tcp
HealthCheckInterval: 10
UnhealthyThreshold: 2
HealthyThreshold: 2
Listener:
Type: ALIYUN::NLB::Listener
Properties:
ServerGroupId:
Ref: ServerGroup
LoadBalancerId:
Ref: LoadBalancerId
ListenerProtocol: TCP
ListenerPort: 80
Enable: true
Outputs:
NlbDnsName:
Description:
en: DNS name of the NLB instance.
zh-cn: NLB实例的DNS名称。
Value:
Fn::Jq:
- First
- .[0].DNSName
- Fn::GetAtt:
- DS_LoadBalancers
- LoadBalancers
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- LoadBalancerId
- EcsInstanceIds
TemplateTags:
- acs:document:试用教程:实现IPv4服务的四层负载均衡