-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::ReleaseEipAddress.yml
101 lines (101 loc) · 2.85 KB
/
ACS::ECS::ReleaseEipAddress.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::ReleaseEipAddress
name-zh-cn: 从实例上解绑并释放EIP
en: Detach and releasse the EIP from the bound instance
zh-cn: 将EIP从绑定的实例上解绑并释放
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
instanceId:
Description:
en: The ID of ECS instance
zh-cn: ECS实例ID
Type: String
Tasks:
- Name: waitInstanceReady
Action: 'ACS::WaitFor'
Delay: 15
Retries: 7
DelayType: Constant
Description:
en: Waits for ECS instance is in the Running or Stopped status
zh-cn: 等待ECS实例至运行中或已停止状态
Properties:
Service: ECS
API: DescribeInstances
Parameters:
RegionId: '{{ regionId }}'
InstanceIds:
- '{{ instanceId }}'
DesiredValues:
- Running
- Stopped
PropertySelector: 'Instances.Instance[].Status'
- Name: describeEipAddresses
Action: 'ACS::ExecuteAPI'
Description:
en: Views the allocationIds of EIP
zh-cn: 获取EIP的实例ID
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AssociatedInstanceId: '{{ instanceId }}'
AssociatedInstanceType: EcsInstance
Outputs:
allocationIds:
Type: List
ValueSelector: '.EipAddresses.EipAddress[].AllocationId'
- Name: unassociateEipAddress
Action: 'ACS::ExecuteAPI'
Description:
en: Unasscocaties the EIP from network interface
zh-cn: 将弹性公网IP(EIP)从绑定的云产品上解绑
OnError: waitEipAddressAvailable
Properties:
Service: ECS
API: UnassociateEipAddress
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ ACS::TaskLoopItem }}'
InstanceId: '{{ instanceId }}'
Loop:
Items: '{{ describeEipAddresses.allocationIds }}'
- Name: waitEipAddressAvailable
Action: 'ACS::WaitFor'
Description:
en: Waits for the EIP util Available
zh-cn: 等待EIP至可用状态
Delay: 15
Retries: 7
DelayType: Constant
OnError: releaseEipAddress
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ ACS::TaskLoopItem }}'
DesiredValues:
- Available
PropertySelector: 'EipAddresses.EipAddress[].Status'
Loop:
Items: '{{ describeEipAddresses.allocationIds }}'
- Action: 'ACS::ExecuteAPI'
Name: releaseEipAddress
Description:
en: Releases the EIP
zh-cn: 释放EIP
Properties:
Service: ECS
API: ReleaseEipAddress
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ ACS::TaskLoopItem }}'
Loop:
Items: '{{ describeEipAddresses.allocationIds }}'