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
383 lines (383 loc) · 11.6 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
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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建1个公网SLB、配置监听;部署1个RDS实例;通过ESS自动扩缩2个ECS实例并接入SLB。
en: Create 1 public-facing SLB (Server Load Balancer), configure listeners; deploy
1 RDS (Relational Database Service) instance; automatically scale out 2 ECS (Elastic
Compute Service) instances using ESS (Elastic Scale Service) and integrate them
into the SLB.
Parameters:
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
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::Image::ImageId
AssociationPropertyMetadata:
InstanceType: ${EcsInstanceType}
SupportedImageOwnerAlias:
- system
- self
- others
Default: centos_7_04_64_20G_alibase_201701015.vhd
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
AssociationPropertyMetadata:
ZoneId: VSwitchZoneId
EcsInternetChargeType:
Type: String
Label:
en: Internet Charge Type
zh-cn: 网络类型
Description:
en: The charge type of public internet instance
zh-cn: 实例的收费类型,paybytraffic:按流量付费,paybybandwidth:按带宽付费
AssociationPropertyMetadata:
LocaleKey: InternetChargeType
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>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: ${EcsInstanceType}
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
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>
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: MySQL
Category: ${Category}
EngineVersion: ${EngineVersion}
ZoneId: ${VSwitchZoneId}
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用于私网访问。
AssociationPropertyMetadata:
LocaleKey: NetType
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: 500
MinValue: 5
MaxValue: 2000
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:
Ref: VSwitchZoneId
VpcId:
Ref: Vpc
CidrBlock: 192.168.0.0/16
Database:
Type: ALIYUN::RDS::DBInstance
Properties:
ZoneId:
Ref: VSwitchZoneId
VpcId:
Ref: Vpc
VSwitchId:
Ref: VSwitch
DBInstanceClass:
Ref: RdsDBInstanceClass
DBInstanceNetType:
Ref: RdsDBInstanceNetType
DBInstanceStorage:
Ref: RdsDBInstanceStorage
Engine: MySQL
EngineVersion:
Ref: EngineVersion
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:
- VSwitchZoneId
- EcsImageId
- EcsInstanceType
- EcsInternetChargeType
- EcsSystemDiskCategory
Label:
default: ECS
- Parameters:
- Category
- EngineVersion
- RdsDBInstanceClass
- RdsDBInstanceNetType
- RdsDBInstanceStorage
- 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实例