forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple-high-available-infrastructure.yml
528 lines (528 loc) · 15.6 KB
/
simple-high-available-infrastructure.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: User can create high available infrastructure. Some ECS and one RDS will be
created. ECS will be attached to one SLB. RDS is across multiple available zone.
All the resources are under VPC environment. The customer could access this infrastructure
through SLB.
zh-cn: 用户可以创建高可用性基础架构。将创建一些ECS和一个RDS。ECS将连接到一个SLB。RDS跨越多个可用区域。所有资源都在VPC环境下。客户可以通过SLB访问此基础架构。
Parameters:
AppEcsImageId:
Type: String
Label:
en: Image ID
zh-cn: 镜像ID
Description:
en: 'Instance Image ID. see detail: <b><a href=''https://www.alibabacloud.com/help/doc-detail/112977.html''
target=''_blank''><font color=''blue''>Find the mirror</font></a></b>'
zh-cn: 实例镜像,详见:<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: ${AppEcsInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
AppEcsInstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: 'Fill in 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: ZoneId
AppEcsMaxAmount:
Type: Number
Label:
en: Number of Instances
zh-cn: 实例数
Description:
en: Number of Extened AppEcs nodes [1, 2]
zh-cn: 扩展的AppEcs节点数[1,2]。
Default: 1
AllowedValues:
- 1
- 2
AppEcsSystemDiskCategory:
Type: String
Label:
en: System Disk Category
zh-cn: 系统盘类型
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: AppEcsInstanceType
ZoneId: ZoneId
InstancePassword:
Type: String
Label:
en: Instance Password
zh-cn: 实例密码
Description:
en: The 8-30 long login password of instance, consists of the uppercase, lowercase
letter and number. <br> special characters include()'~!@#$%^&*_-+=|{}[]:;'<>,.?/.
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三个;<br>特殊字符包括:()'~!@#$%^&*_-+=|{}[]:;'<>,.?/
ConstraintDescription:
en: 'Length 8-30, must contain upper case letters, lower case letters, Numbers,
special symbols three; special characters include: ()`~!@#$%^&*_-+=|{}[]:;''<>,.?/'
zh-cn: 长度8-30,必须包含大写字母、小写字母、数字、特殊符号三种;特殊字符包括:()`~!@#$%^&*_-+=|{}[]:;' <>,.?/
AllowedPattern: '[a-zA-Z0-9-\(\)\`\~\!@\#\$%\^&\*-+=\|\{\}\[\]\:\;\‘\,\.\?\/]*'
MinLength: 8
MaxLength: 30
NoEcho: true
LoadBalancerSpec:
Type: String
Label:
en: Specifications
zh-cn: 规格
Description:
en: Instance specifications,</br>see detail:</b><a href='https://www.alibabacloud.com/help/doc-detail/85939.html'
target='_blank'><b><font color='blue'>Performance Support Type</b></font></a>
zh-cn: 实例规格,</br>详见:</b><a href='https://help.aliyun.com/document_detail/85939.html'
target='_blank'><b><font color='blue'>性能保障型</b></font></a>
Default: slb.s1.small
DBName:
Type: String
Label:
en: DB Name
zh-cn: 数据库名称
Description:
en: The name of APP database. Consist of 2 to 64 characters of lowercase letters,
hyphen or underline. Must begin with a letter and be end with an alphanumeric
character.
zh-cn: 数据库名称,由2到64个字符的小写字母、连字符或下划线组成。必须以字母开头并以字母数字字符结尾。
ConstraintDescription:
en: Consist of 2 to 64 characters of lowercase letters, hyphen or underline.
Must begin with a letter and be end with an alphanumeric character
zh-cn: 由 2 到 64 个小写字母、连字符或下划线字符组成。必须以字母开头并以字母数字字符结尾
Default: myapp
AllowedPattern: '[a-z]{1}[a-z0-9-_]*[a-z0-9]{1}'
MinLength: '2'
MaxLength: '64'
DBUser:
Type: String
Label:
en: DB Username
zh-cn: 数据库的用户名
Description:
en: The username of APP database. Consist of 2 to 16 characters of lowercase
letters, underline. Must begin with a letter and be end with an alphanumeric
character.
zh-cn: 应用程序数据库的用户名。由2到16个小写字母组成,下划线。必须以字母开头,以字母数字字符结尾。
ConstraintDescription:
en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin
with a letter and be end with an alphanumeric character
zh-cn: 由 2 到 16 个小写字母组成,下划线。必须以字母开头,以字母数字字符结尾
Default: my_app
AllowedPattern: '[a-z]{1}[a-z0-9_]*[a-z0-9]{1}'
MinLength: '2'
MaxLength: '16'
Category:
AssociationPropertyMetadata:
LocaleKey: RDSCategory
Default: Null
Required: false
AllowedValues:
- Basic
- HighAvailability
- cluster
Label:
zh-cn: 实例系列
en: Category
Type: String
EngineVersion:
AssociationPropertyMetadata:
Engine: MySQL
Default: '8.0'
Required: true
Label:
zh-cn: 数据库版本号
en: EngineVersion
AssociationProperty: ALIYUN::RDS::Engine::EngineVersion
Type: String
DBInstanceClass:
Type: String
Label:
en: DB Instance Class
zh-cn: 数据库实例类型
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: MySQL
Category: ${Category}
EngineVersion: ${EngineVersion}
ZoneId: ${ZoneId}
Default: rds.mysql.s1.small
DBInstanceStorage:
Type: Number
Label:
en: DB Instance Storage
zh-cn: 数据库实例存储
Description:
en: The size range of RDS instances is 20 - 2000, Incrementing in every 5, unit
GB
zh-cn: RDS实例大小范围为20-2000,每5个增量,单位为GB
Default: 50
DBPassword:
Type: String
Label:
en: DB Password
zh-cn: 数据库用户访问密码
Description:
en: APP database password. [8, 32] characters consist of alphanumeric characters,
hyphen and underline.
zh-cn: 应用程序数据库密码。[8,32]字符由字母数字字符、连字符和下划线组成。
ConstraintDescription:
en: '[8, 32] characters consist of alphanumeric characters, hyphen and underline'
zh-cn: '[8, 32] 个字符由字母数字字符、连字符和下划线组成'
AllowedPattern: '[a-zA-Z0-9-_]*'
MinLength: 8
MaxLength: 32
NoEcho: true
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: 可用区ID
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
Metadata:
ALIYUN::ROS::Designer:
id: 330cdd0f-c5aa-4b36-a26c-bc15946f8719
DefaultSecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
Description: HA default security group
SecurityGroupEgress:
- DestCidrIp: 0.0.0.0/0
IpProtocol: all
NicType: intranet
PortRange: -1/-1
Priority: 1
SecurityGroupIngress:
- IpProtocol: tcp
NicType: intranet
PortRange: 443/443
SourceCidrIp: 0.0.0.0/0
- IpProtocol: tcp
NicType: intranet
PortRange: 80/80
SourceCidrIp: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: c986186f-2469-42ac-8ea8-0affe557b76c
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: Vpc
CidrBlock: 192.168.33.0/24
Metadata:
ALIYUN::ROS::Designer:
id: 562c396f-694d-47c7-b654-2b362b4d9159
AppEcs:
Type: ALIYUN::ECS::InstanceGroup
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Fn::GetAtt:
- DefaultSecurityGroup
- SecurityGroupId
ImageId:
Ref: AppEcsImageId
AllocatePublicIP: 'false'
InstanceType:
Ref: AppEcsInstanceType
IoOptimized: optimized
MaxAmount:
Ref: AppEcsMaxAmount
Password:
Ref: InstancePassword
SystemDiskCategory:
Ref: AppEcsSystemDiskCategory
Metadata:
ALIYUN::ROS::Designer:
id: 1743a713-4ea1-4591-8ec2-fdccdc032ced
AppEcsLoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
AddressType: internet
LoadBalancerName: AppEcsLoadBalancer
LoadBalancerSpec:
Ref: LoadBalancerSpec
Metadata:
ALIYUN::ROS::Designer:
id: 570d489c-ce02-4abf-a4e4-3b5cd7ef2128
AppEcsLoadBalancerListener443:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort: '443'
Bandwidth: -1
HealthCheck:
HealthyThreshold: '2'
Interval: '5'
Port: '443'
Timeout: '2'
UnhealthyThreshold: '4'
ListenerPort: '443'
LoadBalancerId:
Ref: AppEcsLoadBalancer
Persistence:
PersistenceTimeout: 600
StickySession: 'on'
Protocol: tcp
Metadata:
ALIYUN::ROS::Designer:
id: cb796864-8e76-4498-84c4-1e3e0967d1c7
AppEcsLoadBalancerListener80:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort: '80'
Bandwidth: -1
HealthCheck:
HealthyThreshold: '2'
Interval: '5'
Port: '80'
Timeout: '2'
UnhealthyThreshold: '4'
ListenerPort: '80'
LoadBalancerId:
Ref: AppEcsLoadBalancer
Persistence:
PersistenceTimeout: 600
StickySession: 'on'
Protocol: tcp
Metadata:
ALIYUN::ROS::Designer:
id: 1c349eb3-1995-4c76-8740-7b0fb6a2213e
AppEcsSLBAttachment:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
BackendServerList:
Fn::GetAtt:
- AppEcs
- InstanceIds
LoadBalancerId:
Ref: AppEcsLoadBalancer
Metadata:
ALIYUN::ROS::Designer:
id: ecf47590-5d9b-405c-a50c-332da6febf2a
Database:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceDescription: DataBase
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: DBName
DBInstanceStorage:
Ref: DBInstanceStorage
Engine: MySQL
MasterUserPassword:
Ref: DBPassword
EngineVersion:
Ref: EngineVersion
MasterUsername:
Ref: DBUser
MultiAZ: false
Category:
Ref: Category
PreferredBackupPeriod:
- Monday
- Wednesday
PreferredBackupTime: 23:00Z-24:00Z
SecurityIPList: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Designer:
id: eb146133-0fb5-47d7-bec4-5d9bbd70c291
Outputs:
AppEcsLoadBalancerIp:
Description:
en: Public ip for AppEcs service
zh-cn: AppEcs服务的公共IP
Value:
Fn::Join:
- ''
- - https://
- Fn::GetAtt:
- AppEcsLoadBalancer
- IpAddress
- :443
DatabaseInnerConnString:
Description:
en: Database inner connection string
zh-cn: 数据库内部连接字符串
Value:
Fn::GetAtt:
- Database
- InnerConnectionString
DatabaseInnerPort:
Description:
en: Database Inner Port
zh-cn: 数据库内部端口
Value:
Fn::GetAtt:
- Database
- InnerPort
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- ZoneId
- AppEcsInstanceType
- AppEcsImageId
- AppEcsMaxAmount
- AppEcsSystemDiskCategory
- InstancePassword
Label:
default: ECS
- Parameters:
- LoadBalancerSpec
Label:
default: SLB
- Parameters:
- DBName
- DBUser
- Category
- EngineVersion
- DBInstanceStorage
- DBInstanceClass
- DBInstanceStorage
- DBPassword
Label:
default: RDS
TemplateTags:
- acs:example:网络:创建ECS并加入到一个SLB并创建多可用区RDS
ALIYUN::ROS::Designer:
1743a713-4ea1-4591-8ec2-fdccdc032ced:
position:
x: 323
y: 208
size:
height: 60
width: 60
z: 2
1c349eb3-1995-4c76-8740-7b0fb6a2213e:
position:
x: 654
y: 79
size:
height: 60
width: 60
z: 0
330cdd0f-c5aa-4b36-a26c-bc15946f8719:
embeds:
- 562c396f-694d-47c7-b654-2b362b4d9159
- c986186f-2469-42ac-8ea8-0affe557b76c
position:
x: 238
y: 69
size:
height: 345
width: 233.869140625
z: 0
33d26d7c-d602-45ad-98d1-2d2ab94d08d6:
source:
id: ecf47590-5d9b-405c-a50c-332da6febf2a
target:
id: 1743a713-4ea1-4591-8ec2-fdccdc032ced
z: 1
562c396f-694d-47c7-b654-2b362b4d9159:
embeds:
- eb146133-0fb5-47d7-bec4-5d9bbd70c291
- 1743a713-4ea1-4591-8ec2-fdccdc032ced
position:
x: 263
y: 95
size:
height: 195
width: 182
z: 1
570d489c-ce02-4abf-a4e4-3b5cd7ef2128:
position:
x: 654
y: 208
size:
height: 60
width: 60
z: 0
6ab57b2e-504f-4d15-8690-4238666128f4:
source:
id: cb796864-8e76-4498-84c4-1e3e0967d1c7
target:
id: 570d489c-ce02-4abf-a4e4-3b5cd7ef2128
z: 1
abf4f8e4-0d5a-44d6-af41-feef635afb20:
source:
id: 1c349eb3-1995-4c76-8740-7b0fb6a2213e
target:
id: 570d489c-ce02-4abf-a4e4-3b5cd7ef2128
z: 1
bcd7608d-d73a-43eb-9f70-c4ec428fa02f:
source:
id: ecf47590-5d9b-405c-a50c-332da6febf2a
target:
id: 570d489c-ce02-4abf-a4e4-3b5cd7ef2128
z: 1
c986186f-2469-42ac-8ea8-0affe557b76c:
position:
x: 323
y: 322
size:
height: 60
width: 60
z: 1
cb796864-8e76-4498-84c4-1e3e0967d1c7:
position:
x: 654
y: 325
size:
height: 60
width: 60
z: 0
eb146133-0fb5-47d7-bec4-5d9bbd70c291:
position:
x: 321
y: 120
size:
height: 60
width: 60
z: 2
ecf47590-5d9b-405c-a50c-332da6febf2a:
position:
x: 512
y: 208
size:
height: 60
width: 60
z: 0
f1e31658-32cd-490e-9608-3df6e8836df0:
source:
id: 1743a713-4ea1-4591-8ec2-fdccdc032ced
target:
id: c986186f-2469-42ac-8ea8-0affe557b76c
z: 1