forked from aliyun/oos-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACS-ECS-BulkyDeleteInstances.yml
65 lines (65 loc) · 1.7 KB
/
ACS-ECS-BulkyDeleteInstances.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
FormatVersion: OOS-2019-06-01
Description:
en: Bulky delete ECS postpaid instances.
zh-cn: 批量删除ECS按量付费实例。
name-en: ACS-ECS-BulkyDeleteInstances
name-zh-cn: 批量删除ECS实例
categories:
- instance_manage
Parameters:
targets:
Type: Json
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: ALIYUN::ECS::Instance
force:
Description:
en: Whether to force the release of a running instance.
zh-cn: 是否强制释放正在运行的实例。
Type: Boolean
Default: false
rateControl:
Description:
en: Concurrency ratio of task execution.
zh-cn: 任务执行的并发比率。
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Description:
en: The RAM role to be assumed by OOS.
zh-cn: OOS扮演的RAM角色。
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances.
zh-cn: 获取ECS实例。
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: deleteInstance
Action: ACS::ExecuteAPI
Description:
en: Deletes ECS instance with the specified instance ID.
zh-cn: 通过指定实例ID删除实例。
Properties:
Service: ECS
API: DeleteInstance
Parameters:
InstanceId: '{{ ACS::TaskLoopItem }}'
Force: '{{ force }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'