-
Notifications
You must be signed in to change notification settings - Fork 35
/
deploy-the-rds-environment.yml
455 lines (455 loc) · 13.8 KB
/
deploy-the-rds-environment.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建VPC、交换机与多AZ RDS实例,配置高低权限账号及权限,实现经济高效的数据库备份与低延迟查询方案。
en: Create a Virtual Private Cloud (VPC), configure subnets, and deploy Multi-Availability
Zone (Multi-AZ) RDS instances. Set up accounts with granular access control and
permissions to ensure secure operations. Implement cost-effective database backup
strategies and low-latency query solutions.
Parameters:
VpcCidrBlock:
Type: String
Label:
en: VPC CIDR Block
zh-cn: 专有网络网段
Description:
en: 'The IP address range of the VPC in the CIDR Block form; <br>you can use
the following IP address ranges: <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地址段范围,<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>
Default: 192.168.0.0/16
AllowedValues:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
VSw1Zone:
Type: String
Label:
en: 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
RDS resources</font></b>
zh-cn: 可用区ID,<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建RDS资源的规格</font></b>
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VSw1CidrBlock:
Type: String
Label:
en: VSwitch CIDR Block
zh-cn: 交换机网段
Description:
en: Must be a sub-network segment of the proprietary network and is not occupied
by other VSwitches.
zh-cn: 必须是所属专有网络的子网段,并且没有被其他交换机占用。
Default: 192.168.0.0/24
DBInstanceEngineAndVersion:
Type: String
Label:
en: Type And Version
zh-cn: 类型与版本号
Description:
en: Database type and version number.
zh-cn: 数据库类型与版本号。
Default: MySQL-5.6
AllowedValues:
- MySQL-5.5
- MySQL-5.6
- MySQL-5.7
- MySQL-8.0
RdsDBInstanceClass:
Type: String
Label:
en: Specifications
zh-cn: 实例规格
Description:
en: 'Select the instance specification based on the type of database engine
and the available zone support;<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/26312.htm''
target=''_blank''><b><font color=''blue''>Instance specification sheet</font></b></a>'
zh-cn: 根据数据库引擎的类型和可用的区域支持选择实例规格;<br>请参见详细信息:<a href='https://help.aliyun.com/document_detail/26312.html'
target='_blank'><b><font color='blue'>实例规格表</font></b></a>
Default: rds.mysql.s3.large
AllowedValues:
- rds.mysql.s2.large
- rds.mysql.s2.xlarge
- rds.mysql.s3.large
- rds.mysql.m1.medium
- rds.mysql.c1.large
- rds.mysql.c1.xlarge
RdsDBInstanceStorage:
Type: Number
Label:
en: Storage Space
zh-cn: 存储空间
Description:
en: 'Database storage space, units: GB, per 5GB increment, value range: 5-1000.'
zh-cn: 数据库存储空间, 单位:GB, 每5GB进行递增,取值范围:5-1000。
Default: 5
MinValue: 5
MaxValue: 1000
RdsDBName:
Type: String
Label:
en: Business Database Name
zh-cn: 业务数据库名称
Description:
en: 3-64 characters, consisting of lowercase letters, Numbers, middle line,
underline, beginning with lowercase letters and ending with letters or Numbers.
zh-cn: 3-64个字符,由小写字母、数字、中划线、下划线组成,须以小写英文字母开头并以字母或数字结尾。
Default: appdb
RdsTestDBName:
Type: String
Label:
en: Test Database Name
zh-cn: 测试数据库名称
Description:
en: 3-64 characters, consisting of lowercase letters, Numbers, middle line,
underline, beginning with lowercase letters and ending with letters or Numbers.
zh-cn: 3-64个字符,由小写字母、数字、中划线、下划线组成,须以小写英文字母开头并以字母或数字结尾。
Default: demodb
RdsSuperAccountName:
Type: String
Label:
en: High Privilege Account
zh-cn: 高权限账号
Description:
en: 2~256 characters, beginning with Chinese and English letters, can contain
can contain Numbers, Chinese, English, underline, dash line.
zh-cn: 2~256个字符,以中文、英文字母开头,可以包含可以包含数字、中文、英文、下划线、短横线。
Default: admin_dba
RdsSuperAccountPwd:
Type: String
Label:
en: High Privilege Account Password
zh-cn: 高权限账户密码
Description:
en: 'Length 8-32 characters, can contain size letters, Numbers and special symbols
(including:!@ # $% ^ & * - + = _).'
zh-cn: 长度8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
ConstraintDescription:
en: '8-32 characters, can contain size letters, Numbers and special symbols
(including:!@ # $% ^ & * - + = _).'
zh-cn: 8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
MinLength: '8'
MaxLength: '32'
NoEcho: true
RdsNormalAccountName:
Type: String
Label:
en: Ordinary Account
zh-cn: 普通账号
Description:
en: 2~256 characters, beginning with Chinese and English letters, can contain
can contain Numbers, Chinese, English, underline, dash line.
zh-cn: 2~256个字符,以中文、英文字母开头,可以包含可以包含数字、中文、英文、下划线、短横线。
Default: dbbakuser
RdsNormalAccountPwd:
Type: String
Label:
en: Ordinary Account Password
zh-cn: 普通帐号密码
Description:
en: 'Length 8-32 characters, can contain size letters, Numbers and special symbols
(including:!@ # $% ^ & * - + = _).'
zh-cn: 长度8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
ConstraintDescription:
en: '8-32 characters, can contain size letters, Numbers and special symbols
(including:!@ # $% ^ & * - + = _).'
zh-cn: 8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
MinLength: '8'
MaxLength: '32'
NoEcho: true
RdsNormalAccountPrivilege:
Type: String
Label:
en: Access Privilege
zh-cn: 数据库实例普通账号权限
Description:
en: 'Database instance normal account permissions.ReadWrite: read-write - to
meet backup and recovery requirements;ReadOnly: read-only - to meet backup
requirements;DDLOnly: execute DDL only, applicable to MySQL and MariaDB;DMLOnly:
executes DML only, for MySQL and MariaDB.'
zh-cn: 数据库实例普通账号权限。ReadWrite:读写-满足备份和恢复要求;ReadOnly:只读-满足备份要求;DDLOnly:仅执行DDL,适用于MySQL和MariaDB;DMLOnly:只执行DML,适用于MySQL和MariaDB。
Default: ReadOnly
AllowedValues:
- ReadWrite
- ReadOnly
- DDLOnly
- DMLOnly
Resources:
EcsVpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock:
Ref: VpcCidrBlock
VpcName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
Metadata:
ALIYUN::ROS::Designer:
id: 3f29b2b6-5097-4b33-8966-72e6c6c10298
EcsVSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Ref: VSw1Zone
VpcId:
Ref: EcsVpc
CidrBlock:
Ref: VSw1CidrBlock
VSwitchName:
Fn::Join:
- '-'
- - StackId
- Ref: ALIYUN::StackId
DependsOn: EcsVpc
Metadata:
ALIYUN::ROS::Designer:
id: 91b60a1c-2053-4e90-9b25-26ec700475cb
Rds:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: EcsVpc
VSwitchId:
Ref: EcsVSwitch
AllocatePublicConnection: true
DBInstanceClass:
Ref: RdsDBInstanceClass
DBInstanceStorage:
Ref: RdsDBInstanceStorage
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: RdsDBName
- CharacterSetName: utf8
DBName:
Ref: RdsTestDBName
Engine:
Fn::Select:
- '0'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
EngineVersion:
Fn::Select:
- '1'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
MasterUserPassword:
Ref: RdsSuperAccountPwd
MasterUserType: Super
MasterUsername:
Ref: RdsSuperAccountName
MultiAZ: true
SecurityIPList:
Ref: VpcCidrBlock
Tags:
Key: best_practice
Value: '012'
Metadata:
ALIYUN::ROS::Designer:
id: e337762f-371c-472f-b4a8-17dec90eee49
RdsNormalAccount:
Type: ALIYUN::RDS::Account
Properties:
AccountName:
Ref: RdsNormalAccountName
AccountPassword:
Ref: RdsNormalAccountPwd
AccountType: Normal
DBInstanceId:
Ref: Rds
DependsOn:
- Rds
Metadata:
ALIYUN::ROS::Designer:
id: f21b0da8-d4f4-4286-964c-4235eabbaf06
RdsAccountPrivilege1:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountName:
Ref: RdsNormalAccountName
AccountPrivilege:
Ref: RdsNormalAccountPrivilege
DBInstanceId:
Fn::GetAtt:
- Rds
- DBInstanceId
DBName:
Ref: RdsDBName
DependsOn:
- RdsNormalAccount
Metadata:
ALIYUN::ROS::Designer:
id: b492f2ce-4c13-476e-8a6d-5c7353704e0a
RdsAccountPrivilege2:
Type: ALIYUN::RDS::AccountPrivilege
Properties:
AccountName:
Fn::GetAtt:
- RdsNormalAccount
- AccountName
AccountPrivilege:
Ref: RdsNormalAccountPrivilege
DBInstanceId:
Fn::GetAtt:
- Rds
- DBInstanceId
DBName:
Ref: RdsTestDBName
DependsOn:
- RdsNormalAccount
Metadata:
ALIYUN::ROS::Designer:
id: e02412d2-8278-4250-b9ff-1f3a7f86b4b6
Outputs:
RdsDBInstanceId:
Description:
en: Database instance ID
zh-cn: 数据库实例ID
Value:
Fn::GetAtt:
- Rds
- DBInstanceId
RdsInnerConnectionString:
Description:
en: Database instance Intranet connection string
zh-cn: 数据库实例内网连接串
Value:
Fn::GetAtt:
- Rds
- InnerConnectionString
RdsInnerIPAddress:
Description:
en: Database instance Intranet IP
zh-cn: 数据库实例内网IP
Value:
Fn::GetAtt:
- Rds
- InnerIPAddress
RdsInnerPort:
Description:
en: Intranet port for the database instance
zh-cn: 数据库实例的内网端口
Value:
Fn::GetAtt:
- Rds
- InnerPort
RdsPublicConnectionString:
Description:
en: Database public network connection string
zh-cn: 数据库公网连接串
Value:
Fn::GetAtt:
- Rds
- PublicConnectionString
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcCidrBlock
- VSw1Zone
- VSw1CidrBlock
Label:
default: VPC
- Parameters:
- DBInstanceEngineAndVersion
- RdsDBInstanceClass
- RdsDBInstanceStorage
- RdsDBName
- RdsTestDBName
- RdsSuperAccountName
- RdsSuperAccountPwd
- RdsNormalAccountName
- RdsNormalAccountPwd
Label:
default: RDS
TemplateTags:
- acs:solution:备份&容灾:数据库异地备份及查询-部署云上VPC网络的RDS环境
ALIYUN::ROS::Designer:
3f29b2b6-5097-4b33-8966-72e6c6c10298:
embeds:
- 91b60a1c-2053-4e90-9b25-26ec700475cb
position:
x: 74
y: 22
size:
height: 372
width: 302
z: 0
91b60a1c-2053-4e90-9b25-26ec700475cb:
embeds:
- e337762f-371c-472f-b4a8-17dec90eee49
position:
x: 144
y: 90
size:
height: 223
width: 158
z: 1
9e730d9d-36ac-4b5f-a695-49a51582ce26:
source:
id: f21b0da8-d4f4-4286-964c-4235eabbaf06
target:
id: e02412d2-8278-4250-b9ff-1f3a7f86b4b6
z: 1
b492f2ce-4c13-476e-8a6d-5c7353704e0a:
position:
x: 411
y: 279
size:
height: 60
width: 60
z: 0
dd96d99b-00c4-4866-b2d6-ff34a9a36a0f:
source:
id: e02412d2-8278-4250-b9ff-1f3a7f86b4b6
target:
id: e337762f-371c-472f-b4a8-17dec90eee49
z: 1
e02412d2-8278-4250-b9ff-1f3a7f86b4b6:
position:
x: 411
y: 62
size:
height: 60
width: 60
z: 0
e337762f-371c-472f-b4a8-17dec90eee49:
position:
x: 192
y: 167
size:
height: 60
width: 60
z: 2
f04311c6-b898-4d75-b869-9fd6d222cca9:
source:
id: f21b0da8-d4f4-4286-964c-4235eabbaf06
target:
id: e337762f-371c-472f-b4a8-17dec90eee49
z: 1
f06d4b39-fec7-4946-81ab-08b4f24de855:
source:
id: b492f2ce-4c13-476e-8a6d-5c7353704e0a
target:
id: e337762f-371c-472f-b4a8-17dec90eee49
z: 1
f21b0da8-d4f4-4286-964c-4235eabbaf06:
position:
x: 411
y: 167
size:
height: 60
width: 60
z: 0
f2a106b4-95e8-49e6-9b62-a54bcdf1d8e1:
source:
id: f21b0da8-d4f4-4286-964c-4235eabbaf06
target:
id: b492f2ce-4c13-476e-8a6d-5c7353704e0a
z: 1