模板名稱
ACS-ECS-ConvertsPublicIPToNewEIPByInstanceId 將一台執行個體的公網IP轉化為其它Elastic IP Address
模板描述
將一台網路類型為Virtual Private Cloud的ECS執行個體的公網IP轉化為其它Elastic IP Address
模板類型
自動化
所有者
Alibaba Cloud
輸入參數
參數名稱 | 描述 | 類型 | 是否必填 | 預設值 | 約束 |
instanceId | ECS執行個體ID | String | 是 | ||
OOSAssumeRole | OOS扮演的RAM角色 | String | 否 | “” |
輸出參數
參數名稱 | 描述 | 類型 |
AllocationId | String | |
EipAddress | String |
執行此模板需要的權限原則
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:AllocateEipAddress",
"ecs:AssociateEipAddress",
"ecs:ConvertNatPublicIpToEip",
"ecs:DescribeInstances",
"ecs:ModifyInstanceNetworkSpec",
"ecs:UnassociateEipAddress"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"vpc:DescribeEipAddresses"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳情
ACS-ECS-ConvertsPublicIPToNewEIPByInstanceId詳情
模板內容
FormatVersion: OOS-2019-06-01
Description:
en: Converts the public IP address of a VPC-connected ECS instance with another Elastic IP (EIP) address
zh-cn: 將一台網路類型為Virtual Private Cloud的ECS執行個體的公網IP轉化為其它Elastic IP Address
name-en: ACS-ECS-ConvertsPublicIPToNewEIPByInstanceId
name-zh-cn: 將一台執行個體的公網IP轉化為其它Elastic IP Address
categories:
- instance_manage
Parameters:
instanceId:
Label:
en: InstanceId
zh-cn: ECS執行個體ID
Type: String
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: OOS扮演的RAM角色
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: modifyInstanceNetworkSpec
Action: ACS::ExecuteAPI
Description:
en: Modifies the network charge type of the ECS instance with the specified parameters
zh-cn: 轉換ECS執行個體網路付費方式
Properties:
Service: ECS
API: ModifyInstanceNetworkSpec
Parameters:
InstanceId: '{{ instanceId }}'
NetworkChargeType: PayByTraffic
- Name: convertNatPublicIpToEip
Action: ACS::ExecuteApi
Description:
en: Converts the public IP address of a VPC-connected ECS instance to an Elastic IP (EIP) address
zh-cn: 將一台網路類型為Virtual Private Cloud的ECS執行個體的公網IP轉化為Elastic IP Address
Properties:
Service: ECS
API: ConvertNatPublicIpToEip
Parameters:
InstanceId: '{{ instanceId }}'
- Name: getInstanceEIP
Action: ACS::ExecuteApi
Description:
en: Gets ECS instance EIP
zh-cn: 擷取執行個體Elastic IP Address
Properties:
Service: ECS
API: DescribeInstances
Parameters:
InstanceId:
- '{{ instanceId }}'
Outputs:
allocationId:
Type: String
ValueSelector: Instances.Instance[].EipAddress.AllocationId
- Name: unassociateEipAddress
Action: ACS::ExecuteApi
Description:
en: Elastic public network IP (EIP) is unbound from an ECS instacne
zh-cn: Elastic IP Address(EIP)從綁定的ECS執行個體上解除綁定
Properties:
Service: ECS
API: UnassociateEipAddress
Parameters:
InstanceId: '{{ instanceId }}'
AllocationId: '{{ getInstanceEIP.allocationId }}'
- Name: AllocateEipAddress
Action: ACS::ExecuteAPI
Description:
en: Allocate an Eip address
zh-cn: 申請一個Elastic IP Address
Properties:
Service: ECS
API: AllocateEipAddress
Parameters: Null
Outputs:
AllocationId:
Type: String
ValueSelector: AllocationId
EipAddress:
Type: String
ValueSelector: EipAddress
- Name: DescribeEipAddresses
Action: ACS::WaitFor
Description:
en: Waits for the Eip to enter Available status
zh-cn: 等待EIP可用
Properties:
Service: VPC
API: DescribeEipAddresses
Parameters:
AllocationId: '{{ AllocateEipAddress.AllocationId }}'
DesiredValues:
- Available
PropertySelector: EipAddresses.EipAddress[].Status
- Name: AssociateEipAddress
Action: ACS::ExecuteAPI
Description:
en: Bind the new EIP to the ECS instance in the same region
zh-cn: 綁定新EIP到同地區的ECS執行個體上
Properties:
Service: ECS
API: AssociateEipAddress
Parameters:
InstanceId: '{{ InstanceId }}'
AllocationId: '{{ AllocateEipAddress.AllocationId }}'
Outputs:
AllocationId:
Type: String
Value: '{{ AllocateEipAddress.AllocationId }}'
EipAddress:
Type: String
Value: '{{ AllocateEipAddress.EipAddress }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- instanceId
Label:
default:
zh-cn: 選擇執行個體
en: Select Ecs Instances
- Parameters:
- OOSAssumeRole
Label:
default:
zh-cn: 進階選項
en: Control Options