-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS-ECS-RemoveFromSLBWhenPreemptibleInstanceInterrupted.json
172 lines (172 loc) · 4.35 KB
/
ACS-ECS-RemoveFromSLBWhenPreemptibleInstanceInterrupted.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
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
{
"FormatVersion": "OOS-2019-06-01",
"Description": {
"en": "Remove backend servers from SLB when preemptible instance of current region is about to be interrupted",
"zh-cn": "当前地域的抢占式实例即将释放时,将实例从其所在负载均衡后端服务器列表移除",
"name-en": "ACS-ECS-RemoveFromSLBWhenPreemptibleInstanceInterrupted",
"name-zh-cn": "将即将释放的抢占式实例从其所在负载均衡后端服务器列表移除",
"categories": [
"event-trigger"
]
},
"Parameters": {
"OOSAssumeRole": {
"Label": {
"en": "OOSAssumeRole",
"zh-cn": "OOS扮演的RAM角色"
},
"Type": "String",
"Default": ""
},
"tags": {
"Type": "Json",
"Label": {
"en": "Tags",
"zh-cn": "实例的标签"
},
"AssociationProperty": "Tags",
"Default": []
}
},
"RamRole": "{{OOSAssumeRole}}",
"Tasks": [
{
"Name": "eventTrigger",
"Description": {
"en": "Monitor the preemptible instance interruption event",
"zh-cn": "监控抢占式实例的释放事件"
},
"Action": "ACS::EventTrigger",
"Properties": {
"Tags": "{{ tags }}",
"Product": "ECS",
"Name": [
"Instance:PreemptibleInstanceInterruption"
],
"Level": [
"WARN"
],
"Content": {
"action": "delete"
},
"RegionId": [
"{{ ACS::RegionId }}"
]
},
"Outputs": {
"instanceId": {
"ValueSelector": ".content.instanceId",
"Type": "String"
}
}
},
{
"Name": "describeSLB",
"Description": {
"en": "Views the SLB id of preemptible instance interrupted",
"zh-cn": "查询释放的抢占实例所在负载均衡ID"
},
"Action": "ACS::ExecuteAPI",
"Properties": {
"Service": "SLB",
"API": "DescribeLoadBalancers",
"Parameters": {
"ServerId": "{{ eventTrigger.instanceId }}"
}
},
"Outputs": {
"loadBalancerId": {
"ValueSelector": ".LoadBalancers.LoadBalancer[0].LoadBalancerId",
"Type": "String"
}
}
},
{
"Name": "setBackendServers",
"Description": {
"en": "Set the weight of interrupted instance zero on SLB",
"zh-cn": "将释放的实例在负载均衡上的权重设置为0"
},
"Action": "ACS::ExecuteAPI",
"Properties": {
"Service": "SLB",
"API": "SetBackendServers",
"Parameters": {
"BackendServers": [
{
"ServerId": "{{ eventTrigger.instanceId }}",
"Weight": 0
}
],
"LoadBalancerId": "{{describeSLB.loadBalancerId}}"
}
}
},
{
"Name": "waitConnectionExpire",
"Description": {
"en": "Wait created connection expire",
"zh-cn": "等待已经建立的网络连接断开"
},
"Action": "ACS::Sleep",
"Properties": {
"Duration": "PT1M"
}
},
{
"Name": "removeBackendServers",
"Description": {
"en": "Remove the interrupted instance from SLB backend servers list",
"zh-cn": "将释放的实例从负载均衡后端服务器列表上移除"
},
"Action": "ACS::ExecuteAPI",
"Properties": {
"Service": "SLB",
"API": "RemoveBackendServers",
"Parameters": {
"BackendServers": [
{
"ServerId": "{{ eventTrigger.instanceId }}",
"Weight": 0
}
],
"LoadBalancerId": "{{describeSLB.loadBalancerId}}"
}
}
}
],
"Outputs": {
"instanceId": {
"Value": "{{ eventTrigger.instanceId }}",
"Type": "String"
}
},
"Metadata": {
"ALIYUN::OOS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"tags"
],
"Label": {
"default": {
"zh-cn": "选择标签",
"en": "Select Tags"
}
}
},
{
"Parameters": [
"OOSAssumeRole"
],
"Label": {
"default": {
"zh-cn": "高级选项",
"en": "Control Options"
}
}
}
]
}
}
}