forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecs-ipv6-instance.yml
525 lines (525 loc) · 16.4 KB
/
ecs-ipv6-instance.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建双栈云服务器(ECS),自动配置IPv6公网IP,含VPC、安全组、IPv6网关及带宽设置。
en: Create a dual-stack cloud server (ECS) and automatically configure IPv6 public IP, including VPC, security group, IPv6 gateway and bandwidth settings.
Conditions:
CreateLinux:
Fn::Equals:
- centos
- Fn::Select:
- '0'
- Fn::Split:
- _
- Ref: InstanceImageId
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC IPV4 CIDR Block
zh-cn: 专有网络IPV4网段
Description:
en: New proprietary network IP address segment range, recommended use of the
following IP address segments<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>
zh-cn: 新建专有网络IP地址段范围,推荐使用以下的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>
Default: 192.168.0.0/16
AllowedValues:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/8
VSwitchCidrBlock:
Type: String
Label:
en: VSwitch IPV4 CIDR Block
zh-cn: 交换机IPV4网段
Description:
en: Network segments of new switches, subnets of virtual proprietary networks
zh-cn: 新建交换机的网段,所属虚拟专有网络的子网
Default: 192.168.0.0/24
VSwitchZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please
confirm that the Availability Zone supports the specification of creating
ECS resources,which is recommended to be different from other VSwitch Availability
Zone</font></b>
zh-cn: 可用区ID。<br><b>注: <font color='blue'>选择前请确认该可用区是否支持创建ECS资源的规格,建议与其他交换机可用区不同</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
InstanceImageId:
Type: String
Label:
en: Image
zh-cn: 镜像
Description:
en: Image ID,<br>Linux System Select:<font color='red'><b>centos_7</b></font>
<br>Windows System Select:<font color='red'><b>win2008r2;win2012r2;win2016</b></font>
zh-cn: 镜像ID, <br>Linux系统请选择:<font color='red'><b>centos_7</b></font> <br>Windows系统请选择:<font
color='red'><b>win2008r2;win2012r2;win2016</b></font>
AssociationProperty: ALIYUN::ECS::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${InstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
InstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例规格
Description:
en: 'Fill in the specifications that can be used under the VSwitch availability
zone;</b></font><br>general specifications:<font color=''red''><b>ecs.c5.large</b></font><br>note:
a few zones do not support general specifications<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>通用规格:<font color='red'><b>ecs.c5.large</b></font><br>注:可用区可能不支持通用规格<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
SystemDiskSize:
Type: Number
Label:
en: System Disk Space
zh-cn: 系统盘空间
Description:
en: 'System disk size, range of values: 20-500, units: GB.'
zh-cn: 系统盘大小, 取值范围:[20, 500], 单位:GB。
Default: 40
InstancePublicIP:
Type: Boolean
Label:
en: Allocate IPV4 Public IP
zh-cn: 分配IPV4公网IP
Description:
en: Whether to assign a IPV4 common IP.
zh-cn: 是否分配IPV4公共IP。
Default: false
InternetChargeType:
Type: String
Label:
en: IPv6 Metric Bandwidth is Billed.
zh-cn: IPv6公网带宽的计费方式
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
Default: PayByBandwidth
AllowedValues:
- PayByTraffic
- PayByBandwidth
IPV6Bandwidth:
Type: Number
Label:
en: IPv6 Network Gateway Public Network Bandwidth
zh-cn: IPv6网关公网带宽
Description:
en: 'IPv6 network Gateway public network bandwidth, value range: s1, 5000, in
Mbps. When the public network bandwidth billing method is based on the use
of traffic billing value range of 1 to 2000Mbps, when the public network bandwidth
billing method is metered by bandwidth when the value range is 1 to 5000Mbps.'
zh-cn: IPv6网关公网带宽, 取值范围:[1, 5000], 单位:Mbps。当公网带宽计费方式为按使用流量计费时取值范围为1~2000Mbps,当公网带宽计费方式为按带宽计费时取值范围为1~5000Mbps。
Default: 10
IPV6GateWaySpec:
Type: String
Label:
en: Specifications for the IPv6 Gateway
zh-cn: IPv6网关的规格
Description:
en: 'IPv6 gateway specifications, optional values: Small (free version), Medium
(enterprise version), Large (enterprise enhancement version)'
zh-cn: IPv6网关的规格,可选值:Small(免费版),Medium(企业版),Large(企业增强版)
AssociationPropertyMetadata:
LocaleKey: NatGatewaySpec
Default: Small
AllowedValues:
- Small
- Medium
- Large
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>]<br>[ephemeral_ssd: <font color=''green''>Local
SSD 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>]<br>[ephemeral_ssd:
<font color=''green''>本地SSD盘</font>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${InstanceType}
InstancePassword:
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:
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
EnableIpv6: true
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 115aa714-425f-4f78-b761-c8e5c150823b
EcsSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: EcsVpc
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: internet
PortRange: 22/22
Priority: 1
- DestCidrIp: 0.0.0.0/0
IpProtocol: tcp
NicType: intranet
PortRange: 3389/3389
Priority: 1
- IpProtocol: all
Ipv6DestCidrIp: ::/0
NicType: intranet
PortRange: -1/-1
Priority: 1
SecurityGroupIngress:
- IpProtocol: tcp
NicType: internet
PortRange: 22/22
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 3389/3389
Priority: 1
SourceCidrIp: 0.0.0.0/0
- IpProtocol: all
Ipv6SourceCidrIp: ::/0
NicType: intranet
PortRange: -1/-1
Priority: 1
Metadata:
ALIYUN::ROS::Designer:
id: 44bb135d-2053-4986-975b-a473e4c6b9c0
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Ref: EcsVpc
CidrBlock:
Ref: VSwitchCidrBlock
Ipv6CidrBlock: 0
Metadata:
ALIYUN::ROS::Designer:
id: a8949b63-2253-4608-afbb-ab6c5fa98918
EcsInstance:
Type: ALIYUN::ECS::Instance
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
SecurityGroupId:
Ref: EcsSecurityGroup
ImageId:
Ref: InstanceImageId
AllocatePublicIP:
Ref: InstancePublicIP
InstanceType:
Ref: InstanceType
IoOptimized: optimized
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: SystemDiskCategory
SystemDiskSize:
Ref: SystemDiskSize
UserData:
Fn::If:
- CreateLinux
- Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- CurlCli
- Fn::Join:
- ''
- - '#!/bin/sh'
- " \n"
- "cd /opt \n"
- "wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6\
\ \n"
- "chmod +x ./ecs-utils-ipv6 \n"
- "./ecs-utils-ipv6 \n"
- "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" :\
\ \\\"SUCCESS\\\"}\" \n"
- Fn::Replace:
- ros-notify:
Fn::GetAtt:
- WaitConditionHandle
- PowerShellCurlCli
- Fn::Join:
- ''
- - "[powershell]\r\n"
- "New-Item -Path \"C:\\set_ipv6\" -Force -type directory\r\n"
- "cd C:\\set_ipv6 \r\n"
- "$install_dir=\"C:\\set_ipv6\" \r\n"
- "$install_path = \"$install_dir\\ecs-utils-ipv6.exe\" \r\n"
- "$tool_url = 'http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/win/64/ecs-utils-ipv6.exe'\
\ \r\n"
- "Invoke-WebRequest -uri $tool_url -OutFile $install_path \r\n"
- "Unblock-File $install_path \r\n"
- "Start-Process -FilePath \"$install_path\" -ArgumentList \"--noenterkey\"\
\ -NoNewWindow \r\n"
- "ros-notify\r\n"
DependsOn:
- EcsSecurityGroup
- EcsVSwitch
- EcsVpc
Metadata:
ALIYUN::ROS::Designer:
id: 52b79414-601b-4a00-81d0-749e0c714560
EcsAssignIpv6Addresses:
Type: ALIYUN::ECS::AssignIpv6Addresses
Properties:
NetworkInterfaceId:
Fn::GetAtt:
- EcsInstance
- PrimaryNetworkInterfaceId
Ipv6AddressCount: 1
DependsOn:
- EcsInstance
Metadata:
ALIYUN::ROS::Designer:
id: 5bb5d231-f72e-4261-803c-1b3d5306b701
VpcIpv6Gateway:
Type: ALIYUN::VPC::Ipv6Gateway
Properties:
VpcId:
Ref: EcsVpc
Name: MyIpv6Gateway
Spec:
Ref: IPV6GateWaySpec
Metadata:
ALIYUN::ROS::Designer:
id: e308bd39-4dd1-440d-a4c2-cce7bf7cb2df
VpcIpv6InternetBandwidth:
Type: ALIYUN::VPC::Ipv6InternetBandwidth
Properties:
Bandwidth:
Ref: IPV6Bandwidth
InternetChargeType:
Ref: InternetChargeType
Ipv6AddressId:
Fn::Select:
- 0
- Fn::GetAtt:
- EcsAssignIpv6Addresses
- Ipv6AddressIds
Ipv6GatewayId:
Ref: VpcIpv6Gateway
DependsOn:
- EcsAssignIpv6Addresses
- VpcIpv6Gateway
Metadata:
ALIYUN::ROS::Designer:
id: 83bb1843-c8b6-46a1-804e-25f36c9c99c3
WaitConditionHandle:
Type: ALIYUN::ROS::WaitConditionHandle
Properties: {}
Metadata:
ALIYUN::ROS::Designer:
id: 177bf596-5126-4119-9f95-09ccbc237661
WaitCondition:
Type: ALIYUN::ROS::WaitCondition
Properties:
Count: 1
Handle:
Ref: WaitConditionHandle
Timeout: 900
Metadata:
ALIYUN::ROS::Designer:
id: 460d6e5d-1867-4075-8758-a35fee965206
Outputs:
EcsInstanceId:
Description: EcsInstance InstanceId
Value:
Fn::GetAtt:
- EcsInstance
- InstanceId
EcsInstanceIpv6Address:
Description: EcsInstance Ipv6Address
Value:
Fn::Select:
- '0'
- Fn::GetAtt:
- EcsAssignIpv6Addresses
- Ipv6Addresses
EcsInstancePrivateIp:
Description: EcsInstance PrivateIp
Value:
Fn::GetAtt:
- EcsInstance
- PrivateIp
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSwitchCidrBlock
- VSwitchZoneId
- InstanceType
- InstanceImageId
- SystemDiskSize
- InstancePublicIP
- InternetChargeType
- IPV6Bandwidth
- IPV6GateWaySpec
- SystemDiskCategory
- InstancePassword
Label:
default: ECS
TemplateTags:
- acs:example:网络:创建绑定IPV4/IPV6双栈的云服务器
ALIYUN::ROS::Designer:
115aa714-425f-4f78-b761-c8e5c150823b:
embeds:
- a8949b63-2253-4608-afbb-ab6c5fa98918
- 44bb135d-2053-4986-975b-a473e4c6b9c0
- e308bd39-4dd1-440d-a4c2-cce7bf7cb2df
position:
x: 113
y: 1
size:
height: 404
width: 403.8095703125
z: 0
177bf596-5126-4119-9f95-09ccbc237661:
position:
x: -3
y: 52
size:
height: 60
width: 60
z: 0
44bb135d-2053-4986-975b-a473e4c6b9c0:
position:
x: 205
y: 52
size:
height: 60
width: 60
z: 1
460d6e5d-1867-4075-8758-a35fee965206:
position:
x: -3
y: 235
size:
height: 60
width: 60
z: 0
52b79414-601b-4a00-81d0-749e0c714560:
position:
x: 206
y: 238
size:
height: 60
width: 60
z: 2
5bb5d231-f72e-4261-803c-1b3d5306b701:
position:
x: 565
y: 238
size:
height: 60
width: 60
z: 0
6c500ed8-6b4b-4e28-af77-b3216773e115:
source:
id: 460d6e5d-1867-4075-8758-a35fee965206
target:
id: 177bf596-5126-4119-9f95-09ccbc237661
z: 1
83bb1843-c8b6-46a1-804e-25f36c9c99c3:
position:
x: 565
y: 49
size:
height: 60
width: 60
z: 0
8bf0e384-18e0-46c0-835f-1f9ede4322cf:
source:
id: 83bb1843-c8b6-46a1-804e-25f36c9c99c3
target:
id: e308bd39-4dd1-440d-a4c2-cce7bf7cb2df
z: 1
a8949b63-2253-4608-afbb-ab6c5fa98918:
embeds:
- 52b79414-601b-4a00-81d0-749e0c714560
position:
x: 140
y: 163
size:
height: 180
width: 177
z: 1
d852ed1d-2538-40f9-9407-898eff582d4a:
source:
id: 83bb1843-c8b6-46a1-804e-25f36c9c99c3
target:
id: 5bb5d231-f72e-4261-803c-1b3d5306b701
z: 1
de01b11b-fa66-4b85-a672-d553f322d9f9:
source:
id: 5bb5d231-f72e-4261-803c-1b3d5306b701
target:
id: 52b79414-601b-4a00-81d0-749e0c714560
z: 1
dfc26b41-4bcf-4f65-8cf4-094eb9e13231:
source:
id: 52b79414-601b-4a00-81d0-749e0c714560
target:
id: 44bb135d-2053-4986-975b-a473e4c6b9c0
z: 1
e308bd39-4dd1-440d-a4c2-cce7bf7cb2df:
position:
x: 362
y: 49
size:
height: 60
width: 60
z: 1