forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ess-1-slb-2-rds-2-ecs.yml
353 lines (353 loc) · 10.3 KB
/
ess-1-slb-2-rds-2-ecs.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Create 1 SLB, 1 ESS and 1 RDS, create 2 ECS Instances by ESS. Attach ECS Instances
and ESS to the SLB.
zh-cn: 创建1个SLB、1个ESS和1个RDS,通过ESS创建2个ECS实例。将ECS实例和ESS绑定到SLB上。
Parameters:
EcsImageId:
Type: String
Label:
en: Image ID
zh-cn: 镜像ID
Description:
en: Image ID, represents the image resource to startup one ECS instance, <font><a
href='https://www.alibabacloud.com/help/doc-detail/112977.html' target='_blank'><b>View
image resources</b></font color='blue'></a>
zh-cn: 镜像ID,ECS实例的镜像资源,详见:<font><a href='https://help.aliyun.com/document_detail/112977.html'
target='_blank'><b>查看镜像资源</b></font color='blue'></a>
AssociationProperty: ALIYUN::ECS::Instance:ImageId
EcsInstanceType:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: The ECS instance type,go to the product console to ensure the current instance
is available, <font><a href='https://www.alibabacloud.com/help/doc-detail/25378.html'
target='_blank'><b>View instance types</b></font color='blue'></a>.
zh-cn: ECS实例类型,进入产品控制台确保当前实例可用, 详见:<a href='https://help.aliyun.com/document_detail/25378.html'
target='_blank'><b>查看实例类型</b></a>
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
EcsInternetChargeType:
Type: String
Label:
en: Internet Charge Type
zh-cn: 网络类型
Description:
en: The charge type of public internet instance
zh-cn: 实例的收费类型,paybytraffic:按流量付费,paybybandwidth:按带宽付费
Default: paybytraffic
AllowedValues:
- paybytraffic
- paybybandwidth
EcsSystemDiskCategory:
Type: String
Label:
en: System Disk Category
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>]'
Default: cloud_ssd
AllowedValues:
- cloud_efficiency
- cloud_ssd
- cloud
- cloud_essd
- ephemeral_ssd
RdsDBInstanceClass:
Type: String
Label:
en: Instance Type
zh-cn: 实例类型
Description:
en: Select the instance specification based on the type of database engine and
the available area support;<br>see detail,<a href='https://www.alibabacloud.com/help/doc-detail/26312.html'
target='_blank'><b>Instance specification sheet</b></a>
zh-cn: 根据数据库引擎的类型和可用的区域支持选择实例规格;<br>详见:<a href='https://help.aliyun.com/document_detail/26312.html'
target='_blank'><b>实例规格表</b></a>
Default: rds.mysql.s1.small
RdsDBInstanceNetType:
Type: String
Label:
en: Network Type
zh-cn: 网络类型
Description:
en: Database instance net type, Internet for public access, Intranet for private
access.
zh-cn: 数据库实例网络类型,Internet用于公共访问,Intranet用于私网访问。
AllowedValues:
- Internet
- Intranet
RdsDBInstanceStorage:
Type: Number
Label:
en: RDS Instance Storage
zh-cn: RDS 实例存储
Description:
en: 'Incrementing in every 5G, unit: GB'
zh-cn: 每5G递增,单位:GB。
ConstraintDescription:
en: 'Incrementing in every 5G, unit: GB'
zh-cn: 每5G递增,单位:GB。
Default: 5
MinValue: 5
MaxValue: 2000
DBInstanceEngineAndVersion:
Type: String
Label:
en: Engine And Version
zh-cn: 引擎类型及版本
Description:
en: Database instance engine type, default is 'Mysql'.Support MySQL/SQLServer/PostgreSQL/PPAS/MariaDB
now.
zh-cn: 数据库实例引擎类型,默认为Mysql,现在支持Mysql/SQLServer/PostgreSQL/PPAS/MariaDB。
Default: MySQL-5.6
AllowedValues:
- MySQL-5.6
- SQLServer-2008r2
- PostgreSQL-9.4
- PPAS-9.3
RdsSecurityIPList:
Type: String
Label:
en: Security IP List
zh-cn: ECS实例IP列表
Description:
en: The ECS instances IP list access database, separated by commas, do not be
repeated
zh-cn: ECS实例IP列表,访问数据库,用逗号分隔,不重复。
Default: 0.0.0.0/0
EssDefaultCooldown:
Type: Number
Label:
en: Default Cooldown
zh-cn: 冷却时间
Description:
en: The Default cooldown in seconds
zh-cn: 默认冷却时间(秒)
Default: 300
EssMaxSize:
Type: Number
Label:
en: Max Size
zh-cn: ECS实例的最大值
Description:
en: The maximum of ECS instances in scaling group
zh-cn: 缩放组中的ECS实例的最大值
Default: 2
MinValue: 1
MaxValue: 100
EssMinSize:
Type: Number
Label:
en: Min Size
zh-cn: ECS实例的最小值
Description:
en: The minimum of ECS instances in scaling group
zh-cn: 缩放组中的ECS实例的最小值
Default: 2
MinValue: 1
MaxValue: 100
LoadBalancerSpec:
Type: String
Label:
en: Instance Specification
zh-cn: 实例规格
Description:
en: Instance specifications, 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: 实例规格,详见:</b><a href='https://help.aliyun.com/document_detail/85939.html'
target='_blank'><b><font color='blue'>性能保障型</b></font></a>
Default: slb.s1.small
Resources:
LoadBalancer:
Type: ALIYUN::SLB::LoadBalancer
Properties:
AddressType: internet
LoadBalancerSpec:
Ref: LoadBalancerSpec
CreateListener:
Type: ALIYUN::SLB::Listener
Properties:
BackendServerPort: 8080
Bandwidth: 50
HealthCheck:
HealthyThreshold: 3
HttpCode: http_2xx,http_3xx,http_4xx,http_5xx
Interval: 2
Timeout: 5
UnhealthyThreshold: 3
ListenerPort: '80'
LoadBalancerId:
Ref: LoadBalancer
Protocol: http
Scheduler: wrr
Vpc:
Type: ALIYUN::ECS::VPC
Properties:
CidrBlock: 192.168.0.0/16
VpcName: myvpc
VSwitch:
Type: ALIYUN::ECS::VSwitch
Properties:
ZoneId:
Fn::Select:
- '0'
- Fn::GetAZs:
Ref: ALIYUN::Region
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/16
Database:
Type: ALIYUN::RDS::DBInstance
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceClass:
Ref: RdsDBInstanceClass
DBInstanceNetType:
Ref: RdsDBInstanceNetType
DBInstanceStorage:
Ref: RdsDBInstanceStorage
Engine:
Fn::Select:
- '0'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
EngineVersion:
Fn::Select:
- '1'
- Fn::Split:
- '-'
- Ref: DBInstanceEngineAndVersion
SecurityIPList:
Ref: RdsSecurityIPList
SG:
Type: ALIYUN::ECS::SecurityGroup
Properties:
VpcId:
Ref: Vpc
SecurityGroupName: SG-ESS
SSHKeyPair:
Type: ALIYUN::ECS::SSHKeyPair
Properties:
KeyPairName:
Fn::Sub: ess-${ALIYUN::StackId}
LaunchTemplate:
Type: ALIYUN::ECS::LaunchTemplate
Properties:
VSwitchId:
Ref: VSwitch
SecurityGroupId:
Ref: SG
ImageId:
Ref: EcsImageId
InstanceType:
Ref: EcsInstanceType
KeyPairName:
Ref: SSHKeyPair
LaunchTemplateName:
Fn::Sub: ess-${ALIYUN::StackId}
SystemDiskCategory:
Ref: EcsSystemDiskCategory
DependsOn: SSHKeyPair
ScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
Properties:
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceIds:
- Fn::GetAtt:
- Database
- DBInstanceId
DefaultCooldown:
Ref: EssDefaultCooldown
LaunchTemplateId:
Ref: LaunchTemplate
LoadBalancerIds:
- Fn::GetAtt:
- LoadBalancer
- LoadBalancerId
MaxSize:
Ref: EssMaxSize
MinSize:
Ref: EssMinSize
DependsOn:
- CreateListener
- LaunchTemplate
ScalingGroupEnable:
Type: ALIYUN::ESS::ScalingGroupEnable
Properties:
ScalingGroupId:
Ref: ScalingGroup
DependsOn: ScalingGroup
Attachment:
Type: ALIYUN::SLB::BackendServerAttachment
Properties:
BackendServerList:
Fn::GetAtt:
- ScalingGroupEnable
- ScalingInstances
LoadBalancerId:
Ref: LoadBalancer
Outputs:
DBInstanceId:
Value:
Fn::GetAtt:
- Database
- DBInstanceId
PublicConnectionString:
Value:
Fn::GetAtt:
- Database
- PublicConnectionString
PublicPort:
Value:
Fn::GetAtt:
- Database
- PublicPort
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- EcsImageId
- EcsInstanceType
- EcsInternetChargeType
- EcsSystemDiskCategory
Label:
default: ECS
- Parameters:
- RdsDBInstanceClass
- RdsDBInstanceNetType
- RdsDBInstanceStorage
- DBInstanceEngineAndVersion
- RdsSecurityIPList
Label:
default: RDS
- Parameters:
- EssDefaultCooldown
- EssMaxSize
- EssMinSize
Label:
default: ESS
- Parameters:
- LoadBalancerSpec
Label:
default:
en: SLB
zh-cn: 负载均衡
TemplateTags:
- acs:example:弹性计算:通过ESS管理SLB、RDS和ECS实例