ALIYUN::VPC::EIPAssociation用于为云产品实例绑定弹性公网IP(EIP)。
语法
{
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"AllocationId": String,
"InstanceId": String,
"PrivateIpAddress": String,
"Mode": String
}
}
属性
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|
属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
---|---|---|---|---|---|
AllocationId | String | 是 | 是 | 弹性公网IP的ID。 | 无 |
InstanceId | String | 是 | 是 | 云产品实例的ID。 | 支持以下云产品实例类型:
|
PrivateIpAddress | String | 否 | 是 | 交换机网段内的一个私网IP地址。 | 如果不指定该参数,系统将根据VPC ID和交换机ID自动分配一个私网IP地址。 |
Mode | String | 否 | 是 | 绑定模式。 | 取值:
|
返回值
Fn::GetAtt
- EipAddress:弹性公网IP的地址。
- AllocationId:弹性公网IP的ID。
示例
YAML
格式
ROSTemplateFormatVersion: '2015-09-01'
Description:
en: Create a VPC type ECS and bind EIP (existing VPC).
zh-cn: 创建VPC类型ECS,并绑定EIP(已有VPC)。
Parameters:
VPC:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud.
zh-cn: 现有专有网络的实例ID,在专有网络控制台选择专有网络进行查询。
Label:
en: VPC ID
zh-cn: 专有网络VPC实例ID
VSwitch:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VPC}
Type: String
Description:
en: Existing VSwitch ID, query under console-VPC-VSwitch, <font color='red'>VSwitch must be under VPC. ECS will be created under this VSwitch.</font>
zh-cn: 现有交换机ID,在专有网络控制台选择交换机进行查询,<font color='red'>交换机必须在VPC下。ECS将创建在此交换机下。</font>
Label:
en: VSwitch ID
zh-cn: 交换机实例ID
SecurityGroup:
Type: String
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
Description:
en: Please search the business security group ID starting with (sg-xxx) from console-ECS-Network & Security.
zh-cn: 现有业务安全组的实例ID,在ECS控制台选择安全组进行查询。<br><font color='red'>安全组必须归属在VPC下。</font>
Label:
en: Business Security Group ID
zh-cn: 业务安全组ID
AssociationPropertyMetadata:
VpcId: ${VPC}
ECSInstanceType:
AssociationPropertyMetadata:
InstanceChargeType: ${ECSInstanceType}
AssociationProperty: ALIYUN::ECS::Instance::InstanceType
Type: String
Description:
en: <font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]
zh-cn: <font color='blue'><b>1、选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备。</b></font><br><font color='blue'><b>2、取值:</font><br></b></font>[ecs.c5.large:<font color='green'>2vCPU 4 GiB,内网带宽1Gbps、内网收发包30万PPS。</font>]<br></b>[ecs.c5.xlarge:<font color='green'>4vCPU 8GiB,内网带宽1.5Gbps、内网收发包50万PPS。</font>]<br></b>[ecs.c5.2xlarge: <font color='green'>8vCPU 16 GiB,内网带宽2.5 Gbps、内网收发包80万PPS。</font>]
Label:
en: Instance Type
zh-cn: 实例规格
ECSDiskCategory:
Type: String
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
zh-cn: '<font color=''blue''><b>取值:</b></font><br>[cloud_efficiency: <font color=''green''>高效云盘</font>]<br>[cloud_ssd: <font color=''green''>SSD云盘</font>]<br>[cloud_essd: <font color=''green''>ESSD云盘</font>]<br>[cloud: <font color=''green''>普通云盘</font>]<br>[ephemeral_ssd: <font color=''green''>本地SSD盘</font>]'
AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
AssociationPropertyMetadata:
InstanceType: ${ECSInstanceType}
Label:
en: System Disk Type
zh-cn: 系统盘类型
InstanceChargeType:
Type: String
Label:
en: Instance Charge Type
zh-cn: 实例的付费方式
Description:
en: '<font color=''blue''><b>Optional values:</b></font><br>[PostPaid: <font color=''green''>Pay as you go.</font>]<br> [PrePaid: <font color=''green''>Prepaid, monthly subscription.</font>]'
zh-cn: '<font color=''blue''><b>取值:</b></font><br>[PostPaid: <font color=''green''>按量付费。</font>]<br>[PrePaid: <font color=''green''>预付费,包年包月。</font>]'
AllowedValues:
- PostPaid
- PrePaid
Default: PostPaid
KeyPairName:
Type: String
AssociationProperty: ALIYUN::ECS::KeyPair::KeyPairName
Label:
en: Key Pair Name
zh-cn: 密钥对名称
Description:
en: If it is a Windows ECS instance, ignore this parameter. The default is blank.<br>If you have filled in <font color='green'>key pair name</font>, <font color='green'>instance password< The content of /font> will still be set in the instance, but the password login method in the Linux system will be forbidden.<br><font color='red'>Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in.</font>
zh-cn: 如果是Windows ECS实例,则忽略该参数。默认为空。<br>如果已填写<font color='green'>密钥对名称</font>,<font color='green'>实例密码</font>的内容仍会被设置到实例中,但是Linux系统中的密码登录方式会被禁止。<br><font color='red'>请输入已有密钥对的名称。如使用实例密码登录,密钥对名称不需要填写。</font>
Default: Null
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VPC
- VSwitch
- SecurityGroup
Label:
default: 'VPC '
- Parameters:
- ECSInstanceType
- ECSDiskCategory
- InstanceChargeType
- KeyPairName
Label:
default: ECS
TemplateTags:
- Specify the image Id and snapshot to create ECS instance.
Resources:
ECSInstanceGroup:
Type: ALIYUN::ECS::InstanceGroup
Properties:
IoOptimized: optimized
InstanceChargeType:
Ref: InstanceChargeType
SystemDisk_Category:
Ref: ECSDiskCategory
SecurityGroupId:
Ref: SecurityGroup
VSwitchId:
Ref: VSwitch
MaxAmount: 1
SystemDisk_Size: 40
VpcId:
Ref: VPC
ImageId: ubuntu_14
InstanceType:
Ref: ECSInstanceType
AllocatePublicIP: 'false'
Password: Admin@123!
KeyPairName:
Ref: KeyPairName
ElasticIp:
Type: ALIYUN::VPC::EIP
Properties:
Bandwidth: 5
InternetChargeType: PayByTraffic
ElasticIpAssociation:
Type: ALIYUN::VPC::EIPAssociation
Properties:
InstanceId:
Fn::Select:
- 0
- Fn::GetAtt:
- ECSInstanceGroup
- InstanceIds
AllocationId:
Ref: ElasticIp
Outputs:
VpcId:
Description: VPC Id
Value:
Ref: VPC
SecurityGroupId:
Description: Security Group Id
Value:
Ref: SecurityGroup
VSwitchId:
Description: VSwitch Id
Value:
Ref: VSwitch
EipAddress:
Description: IP address of created EIP.
Value:
Fn::GetAtt:
- ElasticIp
- EipAddress
JSON
格式
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"en": "Create a VPC type ECS and bind EIP (existing VPC).",
"zh-cn": "创建VPC类型ECS,并绑定EIP(已有VPC)。"
},
"Parameters": {
"VPC": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud.",
"zh-cn": "现有专有网络的实例ID,在专有网络控制台选择专有网络进行查询。"
},
"Label": {
"en": "VPC ID",
"zh-cn": "专有网络VPC实例ID"
}
},
"VSwitch": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VPC}"
},
"Type": "String",
"Description": {
"en": "Existing VSwitch ID, query under console-VPC-VSwitch, <font color='red'>VSwitch must be under VPC. ECS will be created under this VSwitch.</font>",
"zh-cn": "现有交换机ID,在专有网络控制台选择交换机进行查询,<font color='red'>交换机必须在VPC下。ECS将创建在此交换机下。</font>"
},
"Label": {
"en": "VSwitch ID",
"zh-cn": "交换机实例ID"
}
},
"SecurityGroup": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"Description": {
"en": "Please search the business security group ID starting with (sg-xxx) from console-ECS-Network & Security.",
"zh-cn": "现有业务安全组的实例ID,在ECS控制台选择安全组进行查询。<br><font color='red'>安全组必须归属在VPC下。</font>"
},
"Label": {
"en": "Business Security Group ID",
"zh-cn": "业务安全组ID"
},
"AssociationPropertyMetadata": {
"VpcId": "${VPC}"
}
},
"ECSInstanceType": {
"AssociationPropertyMetadata": {
"InstanceChargeType": "${ECSInstanceType}"
},
"AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
"Type": "String",
"Description": {
"en": "<font color='blue'><b>1.Before selecting the model please confirm that the current available zone under the model is in stock, some models need to be reported in advance</b></font><br><font color='blue'><b>2.List of optional models</font><br></b></font>[ecs.c5.large <font color='green'>2vCPU 4GiB Intranet bandwidth1Gbps In-grid sending and receiving packages30MillionPPS</font>]<br></b>[ecs.c5.xlarge <font color='green'>4vCPU 8GiB Intranet bandwidth1.5Gbps In-grid sending and receiving packages50MillionPPS</font>]<br></b>[ecs.c5.2xlarge <font color='green'>8vCPU 16GiB Intranet bandwidth2.5Gbps In-grid sending and receiving packages80MillionPPS</font>]",
"zh-cn": "<font color='blue'><b>1、选择机型前请先确认当前可用区下该机型是否有货,部分机型需要提前报备。</b></font><br><font color='blue'><b>2、取值:</font><br></b></font>[ecs.c5.large:<font color='green'>2vCPU 4 GiB,内网带宽1Gbps、内网收发包30万PPS。</font>]<br></b>[ecs.c5.xlarge:<font color='green'>4vCPU 8GiB,内网带宽1.5Gbps、内网收发包50万PPS。</font>]<br></b>[ecs.c5.2xlarge: <font color='green'>8vCPU 16 GiB,内网带宽2.5 Gbps、内网收发包80万PPS。</font>]"
},
"Label": {
"en": "Instance Type",
"zh-cn": "实例规格"
}
},
"ECSDiskCategory": {
"Type": "String",
"Description": {
"en": "<font color='blue'><b>Optional values:</b></font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]",
"zh-cn": "<font color='blue'><b>取值:</b></font><br>[cloud_efficiency: <font color='green'>高效云盘</font>]<br>[cloud_ssd: <font color='green'>SSD云盘</font>]<br>[cloud_essd: <font color='green'>ESSD云盘</font>]<br>[cloud: <font color='green'>普通云盘</font>]<br>[ephemeral_ssd: <font color='green'>本地SSD盘</font>]"
},
"AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
"AssociationPropertyMetadata": {
"InstanceType": "${ECSInstanceType}"
},
"Label": {
"en": "System Disk Type",
"zh-cn": "系统盘类型"
}
},
"InstanceChargeType": {
"Type": "String",
"Label": {
"en": "Instance Charge Type",
"zh-cn": "实例的付费方式"
},
"Description": {
"en": "<font color='blue'><b>Optional values:</b></font><br>[PostPaid: <font color='green'>Pay as you go.</font>]<br> [PrePaid: <font color='green'>Prepaid, monthly subscription.</font>]",
"zh-cn": "<font color='blue'><b>取值:</b></font><br>[PostPaid: <font color='green'>按量付费。</font>]<br>[PrePaid: <font color='green'>预付费,包年包月。</font>]"
},
"AllowedValues": [
"PostPaid",
"PrePaid"
],
"Default": "PostPaid"
},
"KeyPairName": {
"Type": "String",
"AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName",
"Label": {
"en": "Key Pair Name",
"zh-cn": "密钥对名称"
},
"Description": {
"en": "If it is a Windows ECS instance, ignore this parameter. The default is blank.<br>If you have filled in <font color='green'>key pair name</font>, <font color='green'>instance password< The content of /font> will still be set in the instance, but the password login method in the Linux system will be forbidden.<br><font color='red'>Please enter the name of the existing key pair. If you use the instance password Login, the key pair name does not need to be filled in.</font>",
"zh-cn": "如果是Windows ECS实例,则忽略该参数。默认为空。<br>如果已填写<font color='green'>密钥对名称</font>,<font color='green'>实例密码</font>的内容仍会被设置到实例中,但是Linux系统中的密码登录方式会被禁止。<br><font color='red'>请输入已有密钥对的名称。如使用实例密码登录,密钥对名称不需要填写。</font>"
},
"Default": null
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VPC",
"VSwitch",
"SecurityGroup"
],
"Label": {
"default": "VPC "
}
},
{
"Parameters": [
"ECSInstanceType",
"ECSDiskCategory",
"InstanceChargeType",
"KeyPairName"
],
"Label": {
"default": "ECS"
}
}
],
"TemplateTags": [
"Specify the image Id and snapshot to create ECS instance."
]
}
},
"Resources": {
"ECSInstanceGroup": {
"Type": "ALIYUN::ECS::InstanceGroup",
"Properties": {
"IoOptimized": "optimized",
"InstanceChargeType": {
"Ref": "InstanceChargeType"
},
"SystemDisk_Category": {
"Ref": "ECSDiskCategory"
},
"SecurityGroupId": {
"Ref": "SecurityGroup"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"MaxAmount": 1,
"SystemDisk_Size": 40,
"VpcId": {
"Ref": "VPC"
},
"ImageId": "ubuntu_14",
"InstanceType": {
"Ref": "ECSInstanceType"
},
"AllocatePublicIP": "false",
"Password": "Admin@123!",
"KeyPairName": {
"Ref": "KeyPairName"
}
}
},
"ElasticIp": {
"Type": "ALIYUN::VPC::EIP",
"Properties": {
"Bandwidth": 5,
"InternetChargeType": "PayByTraffic"
}
},
"ElasticIpAssociation": {
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"InstanceId": {
"Fn::Select": [
0,
{
"Fn::GetAtt": [
"ECSInstanceGroup",
"InstanceIds"
]
}
]
},
"AllocationId": {
"Ref": "ElasticIp"
}
}
}
},
"Outputs": {
"VpcId": {
"Description": "VPC Id",
"Value": {
"Ref": "VPC"
}
},
"SecurityGroupId": {
"Description": "Security Group Id",
"Value": {
"Ref": "SecurityGroup"
}
},
"VSwitchId": {
"Description": "VSwitch Id",
"Value": {
"Ref": "VSwitch"
}
},
"EipAddress": {
"Description": "IP address of created EIP.",
"Value": {
"Fn::GetAtt": [
"ElasticIp",
"EipAddress"
]
}
}
}
}