forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ecs-group-attach-multiple-slb.yml
233 lines (229 loc) · 6.47 KB
/
ecs-group-attach-multiple-slb.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Create an ECS Instance Group attach SLB.
zh-cn: 创建ECS实例组绑定SLB。
Parameters:
ImageId:
Type: String
Label: ECS Image Id
Description: Image Id, represents the image resource to startup one ECS instance,
<a href='#/product/cn-beijing/list/imageList' target='_blank'>View image resources</a>
Default: centos_7
InstanceType:
Type: String
Label: ECS Instance Type
Description: The ECS instance type, <a href='#/product/cn-beijing/list/typeList'
target='_blank'>View instance types</a>
Default: ecs.c5.large
AllowedValues:
- ecs.c5.large
- ecs.g5.large
- ecs.c5.xlarge
- ecs.g5.xlarge
InternetChargeType:
Type: String
Label: Internet Charge Type
Description: Instance internet access charge type.Support 'PayByBandwidth' and
'PayByTraffic' only. Default is PayByTraffic
Default: PayByTraffic
AllowedValues:
- PayByBandwidth
- PayByTraffic
InternetMaxBandwidthOut:
Type: Number
Label: Internet Max Bandwidth Out
Description: '[0,100]'
Default: 1
MinValue: 0
MaxValue: 100
IoOptimized:
Type: String
Label: Io Optimized
Description: The 'optimized' instance can provide better IO performance. Support
'none' and 'optimized' only, default is 'optimized'.
Default: optimized
AllowedValues:
- none
- optimized
SecurityGroupId:
Type: String
Label: Security Group Id
Description: Security group to create ecs instance. For classic instance need
the security group not belong to VPC, for VPC instance, please make sure the
security group belong to specified VPC.
SystemDiskCategory:
Type: String
Label: System Disk Category
Description: Category of system disk. Default is cloud_efficiency. Support cloud|cloud_efficiency|cloud_ssd
Default: cloud_ssd
AllowedValues:
- cloud
- cloud_efficiency
- cloud_ssd
DataDiskCategory:
Type: String
Label: Data Disk Category
Description: 'System disk category: average cloud disk(cloud), efficient cloud
disk(cloud_efficiency) or SSD cloud disk(cloud_ssd).'
Default: cloud_ssd
AllowedValues:
- cloud
- cloud_efficiency
- cloud_ssd
DataDiskSize:
Type: Number
Label: Data Disk Size
Description: 'The size of the first volume, unit in GB.Value range: cloud: [5,2000],
cloud_efficiency: [20,32768], cloud_ssd: [20,32768].The value should be equal
to or greater than the specific snapshot.'
Default: 200
DataSnapshotId:
Type: String
Label: Data Snapshot Id
Description: Disk snapshot ID
InstanceName:
Type: String
Label: ECS Instance Name
Description: '[2, 128] alphanumeric characters, underline, dot or hyphen.'
ConstraintDescription: Consist of 2 to 128 characters of alphanumeric characters
and special characters.
Default: ecsInstance
MinLength: 2
MaxLength: 128
Password:
Type: String
Label: ECS Instance Password
Description: The root password of ECS instance. The password is a string of 8
to 30 characters and must contain uppercase/lowercase letters, numbers.
ConstraintDescription: Consist of 8 to 30 alphanumeric.
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
MinLength: '8'
MaxLength: '30'
NoEcho: true
Confirm: true
MaxAmount:
Type: Number
Label: The Maximum Of ECS Instances
Description: The maximum of ECS instances, must be greater than or equal to the
minimum.
ConstraintDescription: The number between 1 and 100
Default: 1
MinValue: 1
MaxValue: 100
MinAmount:
Type: Number
Label: The Minimum Of ECS Instances
Description: The minimum of ECS instances, must be less than or equal to the maximum.
ConstraintDescription: The number between 1 and 100
Default: 1
MinValue: 1
MaxValue: 100
VpcId:
Type: String
Label: Vpc Id
Description: The VPC ID
VSwitchId:
Type: String
Label: VSwitch Id
Description: Virtual Switch ID
FirstLoadbalancerId:
Type: String
Label: First Loadbalancer Id
Description: The first SLB instance ID
SecondLoadbalancerId:
Type: String
Label: Second Loadbalancer Id
Description: The second SLB instance ID
ThirdLoadbalancerId:
Type: String
Label: Third Loadbalancer Id
Description: The third SLB instance ID
Resources:
ecsInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
SecurityGroupId:
Ref: SecurityGroupId
ImageId:
Ref: ImageId
AllocatePublicIP: 'false'
InstanceName:
Ref: InstanceName
MaxAmount:
Ref: MaxAmount
MinAmount:
Ref: MinAmount
Password:
Ref: Password
InstanceType:
Ref: InstanceType
InternetMaxBandwidthOut:
Ref: InternetMaxBandwidthOut
InternetChargeType:
Ref: InternetChargeType
SystemDiskCategory:
Ref: SystemDiskCategory
IoOptimized:
Ref: IoOptimized
DiskMappings:
- Category:
Ref: DataDiskCategory
Size:
Ref: DataDiskSize
SnapshotId:
Ref: DataSnapshotId
UserData:
Fn::Join:
- ''
- - '#!/bin/sh
'
- 'ip_addr=`ifconfig eth0 | awk ''/inet /{print $2}''`
'
- 'host_name=`hostname`
'
- 'echo "$ip_addr $host_name" >> /etc/hosts
'
AttachmentECSToFirstSLB:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
LoadBalancerId:
Ref: FirstLoadbalancerId
BackendServerList:
Fn::GetAtt:
- ecsInstanceGroup
- InstanceIds
BackendServerWeightList:
- '100'
AttachmentECSToSecondSLB:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
LoadBalancerId:
Ref: SecondLoadbalancerId
BackendServerList:
Fn::GetAtt:
- ecsInstanceGroup
- InstanceIds
BackendServerWeightList:
- '100'
AttachmentECSToThirdSLB:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
LoadBalancerId:
Ref: ThirdLoadbalancerId
BackendServerList:
Fn::GetAtt:
- ecsInstanceGroup
- InstanceIds
BackendServerWeightList:
- '100'
Outputs:
InstanceIds:
Description: The instance id list of created ecs instance.
Value:
Fn::GetAtt:
- ecsInstanceGroup
- InstanceIds