forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
launch-template.yml
268 lines (268 loc) · 9.7 KB
/
launch-template.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
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建ECS启动模板与自动扩容组,配置实例规格、计费策略、容量管理及自动补给策略,实现灵活资源管理和成本优化。
en: Create ECS launch templates and auto-scaling groups, configuring instance types,
billing strategies, capacity management, and automatic replenishment policies
to achieve flexible resource management and cost optimization.
Parameters:
ZoneId:
Type: String
Label: VSwitch Availability Zone
AssociationProperty: ALIYUN::ECS::Instance:ZoneId
VpcId:
Type: String
Label: Existing VPC Instance ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitchId:
Type: String
Label: Existing VSwitch ID
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: VpcId
ZoneId: ZoneId
SecurityGroupId:
Type: String
Label: Business Security Group ID
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: VpcId
LaunchTemplateName:
Type: String
Default: mytest
ImageId:
Type: String
AssociationProperty: ALIYUN::ECS::Instance::ImageId
Default: centos_7
InstanceType:
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
AssociationPropertyMetadata:
ZoneId: ZoneId
Default: ecs.c5.large
SystemDiskCategory:
Type: String
Description: Category of system disk. Default is cloud_efficiency. support cloud|cloud_efficiency|cloud_ssd|cloud_essd|ephemeral_ssd.Old
instances will not be changed.
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
LocaleKey: DiskCategory
InstanceType: InstanceType
Default: cloud_essd
PayAsYouGoTargetCapacity:
Type: String
Description: The target capacity of pay-as-you-go instances in the auto provisioning
group.
Default: '1'
TotalTargetCapacity:
Type: String
Description: |-
The total target capacity of the auto provisioning group. The target capacity consists
of the following three parts:
The target capacity of pay-as-you-go instances specified by the PayAsYouGoTargetCapacity parameter
The target capacity of preemptible instances specified by the SpotTargetCapacity parameter
The supplemental capacity besides PayAsYouGoTargetCapacity and SpotTargetCapacity
Default: '2'
SpotTargetCapacity:
Type: String
Description: The target capacity of preemptible instances in the auto provisioning
group.
Default: '1'
AutoProvisioningGroupName:
Type: String
Description: |-
The name of the auto provisioning group to be created. It must be 2 to 128 characters
in length. It must start with a letter but cannot start with http:// or https://.
It can contain letters, digits, colons (:), underscores (_), and hyphens (-).
Default: mytest
SpotAllocationStrategy:
Type: String
Description: |-
The scale-out policy for preemptible instances. Valid values:
lowest-price: The cost optimization policy the auto provisioning group follows to select instance
types of the lowest cost to create instances.
diversified: The distribution balancing policy the auto provisioning group follows to evenly create
instances across zones specified in multiple extended template configurations.
Default value: lowest-price
Default: lowest-price
AllowedValues:
- diversified
- lowest-price
SpotInstancePoolsToUseCount:
Type: Number
Description: |-
This parameter takes effect when the SpotAllocationStrategy parameter is set to lowest-price. The auto provisioning group selects instance types of the lowest cost to create
instances.
Default: null
PayAsYouGoAllocationStrategy:
Type: String
Description: |-
The scale-out policy for pay-as-you-go instances. Valid values:
lowest-price: The cost optimization policy the auto provisioning group follows to select instance
types of the lowest cost to create instances.
prioritized: The priority-based policy the auto provisioning group follows to create instances.
The priority of an instance type is specified by the LaunchTemplateConfig.N.Priority parameter.
Default value: lowest-price
Default: lowest-price
AllowedValues:
- lowest-price
- prioritized
MaxSpotPrice:
Type: Number
Description: |-
The global maximum price for preemptible instances in the auto provisioning group.
If both the MaxSpotPrice and LaunchTemplateConfig.N.MaxPrice parameters are specified, the maximum price is the lower value of the two.
Default: 5
DefaultTargetCapacityType:
Type: String
Description: |-
The type of supplemental instances. When the total value of PayAsYouGoTargetCapacity and SpotTargetCapacity is smaller than the value of TotalTargetCapacity, the auto provisioning group will create instances of the specified type to meet
the capacity requirements. Valid values:
PayAsYouGo: Pay-as-you-go instances.
Spot: Preemptible instances.
Default value: Spot
Default: PayAsYouGo
AllowedValues:
- PayAsYouGo
- Spot
AutoProvisioningGroupType:
Type: String
Description: |-
The type of the auto provisioning group. Valid values:
request: One-time delivery. After the auto provisioning group is started, it only attempts
to create an instance cluster once. If the cluster fails to be created, the group
does not try again.
maintain: The continuous delivery and maintain capacity type. After the auto provisioning group
is started, it continuously attempts to create and maintain the instance cluster.
The auto provisioning group compares the real-time and target capacity of the cluster.
If the cluster does not meet the target capacity, the group will create instances
until the cluster meets the target capacity.
Default value: maintain
Default: maintain
AllowedValues:
- maintain
- request
ExcessCapacityTerminationPolicy:
Type: String
Description: |-
The shutdown policy for excess preemptible instances followed when the capacity of
the auto provisioning group exceeds the target capacity. Valid values:
no-termination: Excess preemptible instances are not shut down.
termination: Excess preemptible instances are to be shut down. The action to be performed on these
shutdown instances is specified by the SpotInstanceInterruptionBehavior parameter.
Default value: no-termination
Default: termination
AllowedValues:
- no-termination
- termination
TerminateInstances:
Type: Boolean
Description: |-
Specifies whether to release instances of the auto provisioning group. Valid values:
true
false
Default: false
Default: true
AllowedValues:
- true
- false
TerminateInstancesWithExpiration:
Type: Boolean
Description: |-
The shutdown policy for preemptible instances when the auto provisioning group expires.
Valid values:
true: shuts down preemptible instances. The action to be performed on these shutdown instances
is specified by the SpotInstanceInterruptionBehavior parameter.
false: does not shut down preemptible instances.
Default: false
Default: true
AllowedValues:
- true
- false
Resources:
LaunchTemplate:
Type: ALIYUN::ECS::LaunchTemplate
Properties:
VSwitchId:
Ref: VSwitchId
SecurityGroupId:
Ref: SecurityGroupId
ImageId:
Ref: ImageId
LaunchTemplateName:
Ref: LaunchTemplateName
VersionDescription: Test create LaunchTemplate
InstanceType:
Ref: InstanceType
SystemDiskCategory:
Ref: SystemDiskCategory
AutoProvisioningGroup:
Type: ALIYUN::ECS::AutoProvisioningGroup
Properties:
LaunchTemplateId:
Fn::GetAtt:
- LaunchTemplate
- LaunchTemplateId
LaunchTemplateVersion: '1'
TotalTargetCapacity:
Ref: TotalTargetCapacity
PayAsYouGoTargetCapacity:
Ref: PayAsYouGoTargetCapacity
SpotTargetCapacity:
Ref: SpotTargetCapacity
AutoProvisioningGroupName:
Ref: AutoProvisioningGroupName
SpotAllocationStrategy:
Ref: SpotAllocationStrategy
SpotInstancePoolsToUseCount:
Ref: SpotInstancePoolsToUseCount
LaunchTemplateConfig:
- Priority: 1
WeightedCapacity: 1
InstanceType:
Ref: InstanceType
VSwitchId:
Ref: VSwitchId
MaxPrice: 1
Description: Test AutoProvisioningGroup
PayAsYouGoAllocationStrategy:
Ref: PayAsYouGoAllocationStrategy
MaxSpotPrice:
Ref: MaxSpotPrice
DefaultTargetCapacityType:
Ref: DefaultTargetCapacityType
AutoProvisioningGroupType:
Ref: AutoProvisioningGroupType
ExcessCapacityTerminationPolicy:
Ref: ExcessCapacityTerminationPolicy
TerminateInstances:
Ref: TerminateInstances
TerminateInstancesWithExpiration:
Ref: TerminateInstancesWithExpiration
DependsOn: LaunchTemplate
Outputs:
AutoProvisioningGroupId:
Description: The ID of the auto provisioning group.
Value:
Fn::GetAtt:
- AutoProvisioningGroup
- AutoProvisioningGroupId
LaunchTemplateId:
Value:
Fn::GetAtt:
- LaunchTemplate
- LaunchTemplateId
LaunchTemplateName:
Value:
Fn::GetAtt:
- LaunchTemplate
- LaunchTemplateName
DefaultVersionNumber:
Value:
Fn::GetAtt:
- LaunchTemplate
- DefaultVersionNumber
LatestVersionNumber:
Value:
Fn::GetAtt:
- LaunchTemplate
- LatestVersionNumber