-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS-ECS-CorrectSecurityGroupInstancesByTags.json
114 lines (114 loc) · 2.86 KB
/
ACS-ECS-CorrectSecurityGroupInstancesByTags.json
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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"name-en": "ACS-ECS-CorrectSecurityGroupInstancesByTags",
"name-zh-cn": "纠正安全组实例标签",
"en": "Gets an instance from a label and adds the acquired instance to the security group under the specified label",
"zh-cn": "根据标签获取实例并把获取的到的实例加入到指定标签下的安全组中"
},
"Parameters": {
"regionId": {
"Label": {
"en": "RegionId",
"zh-cn": "地域ID"
},
"AssociationProperty": "RegionId",
"Type": "String",
"Default": "{{ ACS::RegionId }}"
},
"tags": {
"Label": {
"en": "Tags",
"zh-cn": "要添加的新ECS实例的标签"
},
"Type": "Json",
"AssociationProperty": "Tags"
}
},
"Tasks": [
{
"Name": "describeInstances",
"Action": "ACS::ExecuteAPI",
"Description": {
"en": "Queries the ECS instances by specifying tag",
"zh-cn": "通过指定标签查看ECS实例"
},
"Properties": {
"Service": "ECS",
"API": "DescribeInstances",
"Parameters": {
"RegionId": "{{ regionId }}",
"Tags": "{{ tags }}"
}
},
"Outputs": {
"instanceIds": {
"Type": "List",
"ValueSelector": "Instances.Instance[].InstanceId"
}
}
},
{
"Action": "ACS::ExecuteApi",
"Name": "getSecurityGrpup",
"Properties": {
"Service": "ECS",
"API": "DescribeSecurityGroups",
"Parameters": {
"RegionId": "{{regionId}}",
"Tags": "{{ tags }}"
}
},
"Outputs": {
"securityGroupId": {
"Type": "String",
"ValueSelector": ".SecurityGroups.SecurityGroup[].SecurityGroupId"
}
},
"OnError": "ACS::END",
"OnSuccess": "ACS::NEXT"
},
{
"Action": "ACS::ExecuteApi",
"Name": "addInstancesToSecurityGrpup",
"Properties": {
"Service": "ECS",
"API": "JoinSecurityGroup",
"Parameters": {
"RegionId": "{{regionId}}",
"InstanceId": "{{ ACS::TaskLoopItem }}",
"SecurityGroupId": "{{ getSecurityGrpup.securityGroupId }}"
}
},
"Outputs": {},
"OnError": "ACS::END",
"OnSuccess": "ACS::NEXT",
"Loop": {
"Items": "{{ describeInstances.instanceIds }}",
"RateControl": {
"MaxErrors": 0,
"Mode": "Concurrency",
"Concurrency": 1
}
}
}
],
"Metadata": {
"ALIYUN::OOS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"regionId",
"tags"
],
"Label": {
"default": {
"zh-cn": "选择标签",
"en": "Select Tags"
}
}
}
]
}
}
}