forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rds-create-instance-database-and-connection.yml
262 lines (262 loc) · 7.85 KB
/
rds-create-instance-database-and-connection.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建高可用RDS MySQL实例,配置网络、存储、账号及安全设置,提供公网/内网访问信息。
en: Create a highly available RDS MySQL instance, configure network settings, storage,
accounts, and security settings, and provide information for public/internet and
private/intranet access.
Parameters:
VSwitchZoneId:
Type: String
Label:
en: VSwitch Availability Zone
zh-cn: 交换机可用区
Description:
zh-cn: 交换机可用区。
en: 'VSwitch Availability Zone. '
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
DBInstanceNetType:
Type: String
Label:
en: Instance Net Type
zh-cn: 实例网络类型
Description:
en: RDS Instance Net Type
zh-cn: RDS实例网络类型
AllowedValues:
- Intranet
- Internet
Default: Intranet
EngineVersion:
Type: String
Label:
en: Engine Version
zh-cn: 数据库版本号
AssociationProperty: ALIYUN::RDS::Engine::EngineVersion
AssociationPropertyMetadata:
Engine: MySQL
Default: "8.0"
DBInstanceStorageType:
Type: String
Label:
zh-cn: 实例存储类型
en: Storage Type
Description:
zh-cn: 实例存储类型;<br>请参见详细信息:<a href='https://help.aliyun.com/document_detail/69795.html'
target='_blank'><b><font color='blue'>存储类型</font></b></a>
en: The storage type of DB instance; see detail <a href='https://www.alibabacloud.com/help/en/apsaradb-for-rds/latest/storage-types'
target='_blank'><b><font color=''blue''>Storage types</font></b></a>'
AllowedValues:
- local_ssd
- cloud_ssd
- cloud_essd
- cloud_essd2
- cloud_essd3
Default: cloud_essd
DBInstanceClass:
Type: String
Label:
en: Instance Class
zh-cn: 实例规格
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ${VSwitchZoneId}
EngineVersion: ${EngineVersion}
DBInstanceStorageType: ${DBInstanceStorageType}
Engine: MySQL
Category: HighAvailability
DBInstanceStorage:
Type: Number
Label:
en: Instance Storage
zh-cn: 实例存储
Description:
en: 'Incrementing in every 5G, unit: GB'
zh-cn: 每5G递增,单位:GB
ConstraintDescription:
en: '[5, 2000] Incrementing in every 5G, unit: GB'
zh-cn: '[5, 2000] 每 5G 递增,单位:GB'
MinValue: 5
MaxValue: 2000
Default: 20
RdsUserType:
Type: String
Label:
zh-cn: 账号类型
en: RDS Account Type
Description:
zh-cn: '数据库账号类型,<b><font color=''blue''>可选值:</font></b><br>[Normal: <font color=''green''>普通账号</font>]<br>[Super: <font color=''green''>高权限账号</font>]'
en: 'Database account type, <b><font color=''blue''>AllowedValues: </font></b><br>[Normal: <font color=''green''>Ordinary account</font>]<br>[Super: <font color=''green''>High-privilege account</font>]'
AllowedValues:
- Super
- Normal
Default: Super
DBName:
Type: String
Label:
zh-cn: 数据库名称
en: DB Name
Description:
zh-cn: 数据库名称,由小写字母、数字及特殊字符(-_)组成,以字母开头,字母或数字结尾,最多64个字符。
en: Database name, consisting of lowercase letters, Numbers, and special characters (-_), starting with letters, ending with letters or Numbers, up to 64 characters.
Default: demodb
RdsAccountName:
Type: String
Label:
zh-cn: 账号
en: Account
Description:
zh-cn: 2~256个字符,以中文、英文字母开头,可以包含可以包含数字、中文、英文、下划线、短横线。
en: 2~256 characters, beginning with Chinese and English letters, can contain can contain Numbers, Chinese, English, underline, dash line.
Default: demouser
RdsAccountPwd:
Type: String
Label:
zh-cn: 帐号密码
en: Account Password
Description:
zh-cn: 长度8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
en: 'Length 8-32 characters, can contain size letters, Numbers and special symbols (including:!@ # $% ^ & * - + = _).'
ConstraintDescription:
zh-cn: 8-32个字符,可包含大小字母、数字及特殊符号(包含:!@#$%^&*-+=_)。
en: '8-32 characters, can contain size letters, Numbers and special symbols (including:!@ # $% ^ & * - + = _).'
MinLength: '8'
MaxLength: '32'
NoEcho: true
Resources:
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName:
Ref: ALIYUN::StackName
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
VpcId:
Ref: Vpc
ZoneId:
Ref: VSwitchZoneId
CidrBlock: 192.168.0.0/24
VSwitchName:
Fn::Join:
- '-'
- - VSwitch
- StackId
- Ref: ALIYUN::StackId
Rds:
Type: ALIYUN::RDS::DBInstance
Properties:
EngineVersion:
Ref: EngineVersion
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceNetType:
Ref: DBInstanceNetType
SecurityIPList: 0.0.0.0/0
Category: HighAvailability
DBInstanceStorageType:
Ref: DBInstanceStorageType
DBInstanceStorage:
Ref: DBInstanceStorage
Engine: MySQL
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
AllocatePublicConnection: true
DBMappings:
- CharacterSetName: utf8
DBName:
Ref: DBName
RdsAccount:
DependsOn:
- Rds
Type: ALIYUN::RDS::Account
Properties:
DBInstanceId:
Ref: Rds
AccountPassword:
Ref: RdsAccountPwd
AccountType:
Ref: RdsUserType
AccountName:
Ref: RdsAccountName
Outputs:
PublicConnectionString:
Description:
zh-cn: 公网连接命令行。
en: Rds Public Connection command line.
Value:
Fn::Sub:
- mysql -h${PublicConnectionString} -u${RdsAccountName} -P${RdsPublicPort} -p
- PublicConnectionString:
Fn::GetAtt:
- Rds
- PublicConnectionString
RdsAccountName:
Ref: RdsAccountName
RdsPublicPort:
Fn::GetAtt:
- Rds
- PublicPort
RdsPublicConnectionString:
Description:
zh-cn: 公网连接地址。
en: Rds Public Connection address.
Value:
Fn::GetAtt:
- Rds
- PublicConnectionString
RdsPublicPort:
Description:
zh-cn: 数据库实例公网端口
en: Public network port of the database instance
Value:
Fn::GetAtt:
- Rds
- PublicPort
RdsInnerConnectionString:
Description:
zh-cn: 内网连接地址。
en: Rds Inner Connection address.
Value:
Fn::GetAtt:
- Rds
- InnerConnectionString
RdsInnerPort:
Description:
zh-cn: 数据库实例内网端口
en: Inner network port of the database instance
Value:
Fn::GetAtt:
- Rds
- InnerPort
RdsAccountName:
Description:
zh-cn: 账号
en: Account
Value:
Ref: RdsAccountName
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VSwitchZoneId
Label:
en: Infrastructure Configuration
zh-cn: 基础资源配置
- Parameters:
- DBInstanceNetType
- EngineVersion
- DBInstanceStorageType
- DBInstanceStorage
- DBInstanceClass
- DBName
- RdsUserType
- RdsAccountName
- RdsAccountPwd
Label:
en: RDS Configuration
zh-cn: RDS配置
TemplateTags:
- acs:document-help:rds:快速创建RDS MySQL实例并进行基本设置