-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathACS::ECS::AllocateEipAddressAndAttachToInstance.yml
213 lines (213 loc) · 5.81 KB
/
ACS::ECS::AllocateEipAddressAndAttachToInstance.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::AllocateEipAddressAndAttachToInstance
name-zh-cn: 创建并绑定EIP(ECS)
en: Create the eip and bind it to ECS instance
zh-cn: 创建EIP并绑定到ECS实例
Parameters:
regionId:
Label:
en: RegionId
zh-cn: 地域ID
Type: String
AssociationProperty: ALIYUN::ECS::RegionId
Default: '{{ ACS::RegionId }}'
instanceId:
Label:
en: ECSInstanceId
zh-cn: ECS实例ID
Type: String
AssociationProperty: ALIYUN::ECS::Instance::InstanceId
AssociationPropertyMetadata:
RegionId: regionId
internetChargeType:
Label:
en: EIPInternetChargeType
zh-cn: EIP的计费方式
Type: String
AllowedValues:
- PayByBandwidth
- PayByTraffic
Default: PayByBandwidth
bandwidth:
Label:
en: EIPBandwidth
zh-cn: EIP的带宽峰值
Type: Number
Default: 5
tags:
Label:
en: Tags
zh-cn: 标签
Description:
en: The tags for EIP(format:[{"Key":"test1","Value":"test1"},{"Key":"test2","Value":"test2"}])
zh-cn: 'EIP的标签,格式: [{"Key":"test1","Value":"test1"},{"Key":"test2","Value":"test2"}]'
Type: Json
AssociationProperty: Tags
AssociationPropertyMetadata:
ShowSystem: false
Default: [{"Key":"oos_generate","Value":"{{ACS::ExecutionId}}"}]
ISP:
Label:
en: ISP
zh-cn: EIP的线路类型
Type: String
AllowedValues:
- BGP
- BGP_PRO
Default: BGP
Tasks:
- Name: waitInstanceReady
Action: 'ACS::WaitFor'
Delay: 15
Retries: 7
DelayType: Constant
Description:
en: Waits for ECS instance enter to the Running or Stopped status
zh-cn: 等待ECS实例进入Running或Stopped状态
Properties:
Service: ECS
API: DescribeInstances
Parameters:
RegionId: '{{ regionId }}'
InstanceIds:
- '{{ instanceId }}'
DesiredValues:
- Running
- Stopped
PropertySelector: 'Instances.Instance[].Status'
- Name: allocateEipAddress
Action: 'ACS::ExecuteAPI'
Description:
en: Allocates an EIP
zh-cn: 获取一个弹性公网IP
Properties:
Service: ECS
API: AllocateEipAddress
Parameters:
RegionId: '{{ regionId }}'
InternetChargeType: '{{ internetChargeType }}'
Bandwidth: '{{ bandwidth }}'
ISP: '{{ ISP }}'
Outputs:
allocationId:
Type: String
ValueSelector: .AllocationId
- Name: waitEipAddressReady
Action: 'ACS::WaitFor'
Description:
en: Waits for the EIP enter to Available status
zh-cn: 等待EIP进入Available状态
Delay: 15
Retries: 7
DelayType: Constant
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
DesiredValues:
- Available
PropertySelector: 'EipAddresses.EipAddress[].Status'
- Name: tagResources
Action: 'ACS::CheckFor'
Description:
en: Adds tags on EIP
zh-cn: 给EIP打标签
OnError: associateEipAddress
Properties:
Service: VPC
API: TagResources
Parameters:
RegionId: '{{ regionId }}'
ResourceType: EIP
ResourceId:
- '{{ allocateEipAddress.allocationId }}'
Tags: '{{ tags }}'
DesiredValues:
- true
- false
PropertySelector: .Code | not
Outputs:
code:
Type: String
ValueSelector: .Code | not
- Name: associateEipAddress
Action: 'ACS::ExecuteAPI'
Description:
en: Binds the EIP to instance
zh-cn: 绑定EIP到实例
OnError: unassociateEipAddress
Properties:
Service: ECS
API: AssociateEipAddress
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
InstanceId: '{{ instanceId }}'
- Name: waitEipAddressInUse
Action: 'ACS::WaitFor'
Description:
en: Waits for the eip util In_use
zh-cn: 等待EIP到达In_use状态
Delay: 15
Retries: 7
DelayType: Constant
OnSuccess: 'ACS::END'
OnError: unassociateEipAddress
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
DesiredValues:
- InUse
PropertySelector: 'EipAddresses.EipAddress[].Status'
- Name: unassociateEipAddress
Action: 'ACS::ExecuteAPI'
Description:
en: Unasscocaties the eip from instance
zh-cn: 从实例上解绑EIP
OnError: waitEipAddressAvailable
Properties:
Service: ECS
API: UnassociateEipAddress
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
InstanceId: '{{ instanceId }}'
- Name: waitEipAddressAvailable
Action: 'ACS::WaitFor'
Description:
en: Waits for the eip util Available
zh-cn: 等待EIP到达Available状态
Delay: 15
Retries: 7
DelayType: Constant
OnError: releaseEipAddress
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
DesiredValues:
- Available
PropertySelector: 'EipAddresses.EipAddress[].Status'
- Action: 'ACS::ExecuteAPI'
Name: releaseEipAddress
Description:
en: Releases the EIP
zh-cn: 释放EIP
Properties:
Service: ECS
API: ReleaseEipAddress
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
Outputs:
instanceAndAllocationId:
Type: String
Value: '{instanceId:{{ instanceId }}, allocationId: {{ allocateEipAddress.allocationId }}}'