-
Notifications
You must be signed in to change notification settings - Fork 35
/
batch-of-ecs-instances.yml
556 lines (556 loc) · 17.3 KB
/
batch-of-ecs-instances.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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 此模板支持批量创建按量付费或包年包月的ECS实例,并且支持选择已有VPC,VSW,SG或新建VPC,VSW,SG的场景。
en: This template supports bulk creation of ECS instances for pay-per-view or annual
package months, and supports scenarios where you already have a VPC, VSW, SG,
or new VPC, VSW, SG.
Conditions:
CreateVpcConditions:
Fn::Equals:
- true
- Ref: WhetherCreateVpc
Parameters:
WhetherCreateVpc:
Type: Boolean
Label:
en: WhetherCreateVpc
zh-cn: 是否新建VPC
Default: false
VSwitchZoneId:
Type: String
Label:
en: VSwitch Zone ID
zh-cn: 交换机可用区
Description:
en: Availability ID for existing switches
zh-cn: 现有交换机的可用区ID
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR IPv4 Block
zh-cn: 专有网络IPv4网段
Description:
zh-cn: VPC的IP地址段范围,<br>您可以使用以下的IP地址段或其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
en: 'The IP address range of the VPC in the CidrBlock form; <br>You can use the following IP address ranges and their subnets: <br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${WhetherCreateVpc}
- true
Default: 192.168.0.0/16
VSwitchCidrBlock:
Type: String
Label:
en: ECS VSwitch CIDR Block
zh-cn: ECS交换机子网网段
Description:
zh-cn: 必须属于VPC的子网段。
en: Must belong to the subnet segment of VPC.
AssociationProperty: ALIYUN::VPC::VSwitch::CidrBlock
AssociationPropertyMetadata:
VpcCidrBlock: VpcCidrBlock
Visible:
Condition:
Fn::Equals:
- ${WhetherCreateVpc}
- true
Default: 192.168.1.0/24
VpcId:
Type: String
Label:
en: VPC ID
zh-cn: 专有网络VPC实例ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Equals:
- ${WhetherCreateVpc}
- false
Default: ''
VSwitchId:
Type: String
Label:
en: VSwitch ID
zh-cn: 交换机实例ID
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${VSwitchZoneId}
Visible:
Condition:
Fn::Equals:
- ${WhetherCreateVpc}
- false
Default: ''
SecurityGroupId:
Type: String
Label:
en: Business Security Group ID
zh-cn: 业务安全组ID
Description:
en: Please search the business security group ID starts with(sg-xxx)from console-ECS-Network
& Security
zh-cn: 现有业务安全组的实例ID,控制台-ECS-网络与安全-安全组下查询
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: ${VpcId}
Visible:
Condition:
Fn::Equals:
- ${WhetherCreateVpc}
- false
Default: null
Count:
Type: Number
Label:
en: Number of ECS hosts
zh-cn: ECS主机数量
Description:
en: Number of ECS hosts
zh-cn: ECS主机数量
Default: 2
PayType:
Type: String
Label:
en: ECS Instance Charge Type
zh-cn: ECS付费类型
AssociationProperty: ChargeType
AssociationPropertyMetadata:
LocaleKey: InstanceChargeType
Default: PostPaid
AllowedValues:
- PostPaid
- PrePaid
PayPeriodUnit:
Type: String
Label:
en: Pay Period Unit
zh-cn: 购买资源时长周期
AssociationProperty: PayPeriodUnit
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: Month
AllowedValues:
- Month
- Year
PayPeriod:
Type: Number
Label:
en: Period
zh-cn: 购买资源时长
AssociationProperty: PayPeriod
AssociationPropertyMetadata:
Visible:
Condition:
Fn::Not:
Fn::Equals:
- ${PayType}
- PostPaid
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: 'Fill in the specifications that can be used under the VSwitch availability
zone;<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html''
target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
zh-cn: 填写VSwitch可用区下可使用的规格;<br>规格详见:<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b><font color='blue'>实例规格族</font></a></b>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
EcsImageId:
Type: String
Label:
en: Image
zh-cn: 镜像
Description:
en: Image ID,see detail:<b><a href='https://www.alibabacloud.com/help/en/doc-detail/112977.html'
target='_blank'><font color='blue'>Find the mirror</font></a></b>
zh-cn: 镜像ID, 详见:<b><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><font color='blue'>查找镜像</font></a></b>
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
InstanceName:
Type: String
Label:
en: Instance Name
zh-cn: ECS实例名称
Description:
en: The name of ECS instance,[2, 128] English or Chinese characters, must start
with a letter or Chinese in size, can contain numbers, '_' or '.', '-'.
zh-cn: ECS实例名称,[2,128]英文或中文字符,必须以字母或中文开头,可以包含数字、下划线或“.”、“-”。
Default: k8s-node-[1,3]-alibabacloud
HostName:
Type: String
Label:
en: Host Name
zh-cn: 主机名
Description:
en: Linux system, 2-64 characters in length, cannot use (.) or (-) symbols consecutically
and cannot begin or end with a dot (.) or a hyphen (-). Upper and lower case
letters, Numbers, or hyphens (-) are allowed.
zh-cn: Linux系统,长度2-64个字符,不能连续使用(.)或(-)符号并且不能以点号(.)或连字符(-)开头或结尾,允许使用大小写字母、数字或连字符(-)。
Default: k8s-node-[1,3]-alibabacloud
SystemDiskCategory:
Type: String
Label:
en: System Disk Type
zh-cn: 系统盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${VSwitchZoneId}
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 40-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[40, 500], 单位:GB。
Default: 40
DataDiskCategory:
Type: String
Label:
en: Data Disk Type
zh-cn: 数据盘盘类型
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency:
<font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD
Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud:
<font color=''green''>Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>可选值:</b></font><br>[cloud_efficiency: <font
color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd:
<font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]'
AssociationProperty: ALIYUN::ECS::Disk::DataDiskCategory
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
ZoneId: ${VSwitchZoneId}
DataDiskSize:
Type: Number
Label:
en: Data Disk Space
zh-cn: 数据盘空间
Description:
en: 'ECS Instance disk size, range of values: 20-32768, units: GB'
zh-cn: ECS实例数据盘大小,单位为GiB。取值范围:20~32768
Default: 100
MinValue: 20
MaxValue: 32768
RetentionDay:
Type: Number
Label:
en: Retention time of the Snapshot Policy.
zh-cn: 快照备份策略的保留时间
Description:
en: 'The retention time for automatic snapshots in days. Value range: s1, 65536,
-1: Permanently saved..'
zh-cn: 自动快照备份策略的保留时间,单位为天。取值范围:[1, 65536],-1:永久保存。
Default: 10
TimePoint:
Type: Json
Label:
en: The Point in time at which the Snapshot Policy was created.
zh-cn: 快照备份策略的创建时间点
Description:
en: 'The creation point in hours of the creation of the automatic snapshot,
with a range of values: .0, 23, representing a total of 24 points in time
from 00:00 to 23:00. Multiple points in time are available . . . 0, 1, ...
23) indicates.'
zh-cn: 自动快照备份策略的创建时间点,单位为小时,取值范围:[0, 23],代表 00:00 至 23:00 共 24 个时间点。多个时间点可用
["0", "1", … "23"]表示。
Default:
- '0'
RepeatWeekday:
Type: Json
Label:
en: The Duplicate Date of the Snapshot Policy.
zh-cn: 快照备份策略的重复日期
Description:
en: 'The recurring date of the automatic snapshot, in days and the period of
the week. Value range: s1, 7, such as 1 for Monday, multiple points in time
in a format similar to s1, 2, ... 7 is indicated.'
zh-cn: 自动快照备份策略的重复日期,单位为天,周期为星期。取值范围:[1, 7],如 1 表示周一,多个时间点用一个格式类似 ["1", "2",
… "7"] 表示。
Default:
- '1'
Password:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: Server login password, Length 8-30, must contain three(Capital letters,
lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol
in).
zh-cn: 服务器登录密码,长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
ConstraintDescription:
en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers,
()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
zh-cn: 长度8-30,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。
AllowedPattern: '[0-9A-Za-z\_\-\&:;''<>,=%`~!@#\(\)\$\^\*\+\|\{\}\[\]\.\?\/]+$'
MinLength: 8
MaxLength: 30
NoEcho: true
Resources:
AutoSnapshotPolicy:
Type: ALIYUN::ECS::AutoSnapshotPolicy
Properties:
AutoSnapshotPolicyName: MyAutoSnapshotPolicy
RepeatWeekdays:
Ref: RepeatWeekday
RetentionDays:
Ref: RetentionDay
TimePoints:
Ref: TimePoint
Metadata:
ALIYUN::ROS::Designer:
id: 37f39842-8c75-49f6-985f-b87e1d19e959
ECSInstances:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Fn::If:
- CreateVpcConditions
- Ref: Vpc
- Ref: VpcId
VSwitchId:
Fn::If:
- CreateVpcConditions
- Ref: VSwitch
- Ref: VSwitchId
SecurityGroupId:
Fn::If:
- CreateVpcConditions
- Ref: SecurityGroup
- Ref: SecurityGroupId
ImageId:
Ref: EcsImageId
AllocatePublicIP: true
DiskMappings:
- Category:
Ref: DataDiskCategory
Size:
Ref: DataDiskSize
HostName:
Ref: HostName
InstanceChargeType:
Ref: PayType
InstanceName:
Ref: InstanceName
InstanceType:
Ref: InstanceType
MaxAmount:
Ref: Count
Password:
Ref: Password
Period:
Ref: PayPeriod
PeriodUnit:
Ref: PayPeriodUnit
SystemDiskAutoSnapshotPolicyId:
Ref: AutoSnapshotPolicy
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
Metadata:
ALIYUN::ROS::Designer:
id: 3d97f557-f6c2-475f-bdca-942c45e583b5
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Condition: CreateVpcConditions
Properties:
VpcId:
Fn::If:
- CreateVpcConditions
- Ref: Vpc
- Ref: VpcId
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: intranet
PortRange: -1/-1
Priority: 1
SecurityGroupIngress:
- IpProtocol: all
NicType: internet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: all
NicType: intranet
PortRange: -1/-1
Priority: 1
SourceCidrIp: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: de0e55c1-4cf9-4647-bbdd-6e1c8deba4cd
VSwitch:
Type: ALIYUN::ECS::VSwitch
Condition: CreateVpcConditions
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Fn::If:
- CreateVpcConditions
- Ref: Vpc
- Ref: VpcId
CidrBlock:
Ref: VSwitchCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: cc854ba9-a556-4503-8c21-e52165d2ecde
Vpc:
Type: ALIYUN::ECS::VPC
Condition: CreateVpcConditions
Properties:
CidrBlock:
Ref: VpcCidrBlock
Metadata:
ALIYUN::ROS::Designer:
id: ccfeb4a0-28d4-4c68-949e-d7d920b5256c
Outputs:
InstanceIds:
Value:
Fn::GetAtt:
- ECSInstances
- InstanceIds
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- WhetherCreateVpc
- VpcId
- VSwitchZoneId
- VSwitchId
- SecurityGroupId
- VpcCidrBlock
- VSwitchCidrBlock
Label:
default:
en: Infrastructure Configuration
zh-cn: 基础资源配置(必填)
- Parameters:
- Count
- PayType
- PayPeriodUnit
- PayPeriod
- InstanceType
- EcsImageId
- InstanceName
- HostName
- SystemDiskCategory
- SystemDiskSize
- DataDiskCategory
- DataDiskSize
- RetentionDay
- TimePoint
- RepeatWeekday
- Password
Label:
default:
en: ECS Configuration
zh-cn: ECS 配置(必填)
TemplateTags:
- acs:example:弹性计算:批量创建ECS实例(可选已有/新建VPC与按量付费/包年包月模式)
ALIYUN::ROS::Designer:
37f39842-8c75-49f6-985f-b87e1d19e959:
position:
x: 110
y: -37
size:
height: 60
width: 60
z: 1
3d97f557-f6c2-475f-bdca-942c45e583b5:
position:
x: -125
y: -37
size:
height: 60
width: 60
z: 1
7f78105a-849a-452c-be8e-582800fd838c:
source:
id: 3d97f557-f6c2-475f-bdca-942c45e583b5
target:
id: 37f39842-8c75-49f6-985f-b87e1d19e959
z: 1
af7924e8-1d52-4afe-ae95-ba487301da0b:
source:
id: 3d97f557-f6c2-475f-bdca-942c45e583b5
target:
id: de0e55c1-4cf9-4647-bbdd-6e1c8deba4cd
z: 1
cc854ba9-a556-4503-8c21-e52165d2ecde:
position:
x: -190
y: -59
size:
height: 304
width: 429.8799743652344
z: 1
ccfeb4a0-28d4-4c68-949e-d7d920b5256c:
embeds:
- de0e55c1-4cf9-4647-bbdd-6e1c8deba4cd
- 3d97f557-f6c2-475f-bdca-942c45e583b5
- 37f39842-8c75-49f6-985f-b87e1d19e959
- cc854ba9-a556-4503-8c21-e52165d2ecde
position:
x: -265
y: -132
size:
height: 435
width: 551.2639770507812
z: 0
de0e55c1-4cf9-4647-bbdd-6e1c8deba4cd:
position:
x: -125
y: 155
size:
height: 60
width: 60
z: 1