forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
nlb-4-layer-load-balancing.yml
92 lines (92 loc) · 2.37 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
ROSTemplateFormatVersion: '2015-09-01'
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服务的四层负载均衡