-
Notifications
You must be signed in to change notification settings - Fork 17
/
ACS::ECS::AllocateAndAssociateEipAddress.yml
121 lines (121 loc) · 3.29 KB
/
ACS::ECS::AllocateAndAssociateEipAddress.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
FormatVersion: OOS-2019-06-01
Description:
name-en: ACS::ECS::AllocateAndAssociateEipAddress
name-zh-cn: 创建并绑定EIP到实例
en: Allocate and associate eip address to instance
zh-cn: 创建并绑定EIP到实例
Parameters:
regionId:
Description:
en: The ID of region
zh-cn: 地域ID
Type: String
Default: '{{ ACS::RegionId }}'
instanceId:
Description:
en: The ID of ECS Instance
zh-cn: ECS实例ID
Type: String
instanceType:
Description:
en: The type of instance
zh-cn: 实例类型
Type: String
AllowedValues:
- Nat
- SlbInstance
- EcsInstance
- NetworkInterface
- HaVip
Default: NetworkInterface
internetChargeType:
Description:
en: EIP measurement method
zh-cn: EIP的计费方式
Type: String
AllowedValues:
- PayByBandwidth
- PayByTraffic
Default: PayByBandwidth
bandwidth:
Description:
en: Peak bandwidth of eip
zh-cn: EIP的带宽峰值
Type: Number
Default: 5
Tasks:
- Name: getNetworkInterfaceAttr
Description:
en: Views the NetworkInterface attr
zh-cn: 获取网卡属性
Action: 'ACS::ExecuteApi'
Properties:
Service: ECS
API: DescribeNetworkInterfaces
Parameters:
RegionId: '{{ regionId }}'
NetworkInterfaceId:
- '{{ instanceId }}'
Outputs:
associatedPublicIp:
Type: String
ValueSelector: 'NetworkInterfaceSets.NetworkInterfaceSet[].PrivateIpSets.PrivateIpSet[].AssociatedPublicIp.PublicIpAddress'
- Name: whetherToAllocateEipAddress
Action: 'ACS::Choice'
Description:
en: Choose next task by NetworkInterface attr
zh-cn: 根据网卡属性选择下一个任务
Properties:
DefaultTask: 'ACS::END'
Choices:
- When:
'Fn::Equals':
- Null
- '{{ getNetworkInterfaceAttr.associatedPublicIp }}'
NextTask: allocateEipAddress
- 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 }}'
Outputs:
allocationId:
Type: String
ValueSelector: .AllocationId
- Name: waitEipAddressReady
Action: 'ACS::WaitFor'
Description:
en: Waits for the EIP enter to Available status
zh-cn: 等待EIP可用
Delay: 15
Retries: 7
DelayType: Constant
Properties:
Service: ECS
API: DescribeEipAddresses
Parameters:
RegionId: '{{ regionId }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'
DesiredValues:
- Available
PropertySelector: 'EipAddresses.EipAddress[].Status'
- Name: AssociateEipAddress
Action: 'ACS::ExecuteAPI'
Description:
en: Associates Eip address to instance
zh-cn: 绑定EIP到实例
Properties:
Service: VPC
API: AssociateEipAddress
Parameters:
RegionId: '{{ regionId }}'
InstanceId: '{{ instanceId }}'
InstanceType: '{{ InstanceType }}'
AllocationId: '{{ allocateEipAddress.allocationId }}'