ALIYUN::VPC::EIPAssociation is used to associate an elastic IP address (EIP) with a cloud service instance.
Syntax
{
"Type": "ALIYUN::VPC::EIPAssociation",
"Properties": {
"AllocationId": String,
"InstanceId": String,
"PrivateIpAddress": String,
"Mode": String
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
AllocationId | String | Yes | Yes | The ID of the EIP. | None |
InstanceId | String | Yes | Yes | The ID of the cloud service instance. | The following types of instances are supported:
|
PrivateIpAddress | String | No | Yes | The private IP address in the CIDR block of the vSwitch. | If you do not set this property, the system allocates a private IP address based on the VPC ID and vSwitch ID. |
Mode | String | No | Yes | The association mode. | Defaut value: NAT. Valid values:
|
Return values
Fn::GetAtt
- EipAddress: the EIP.
- AllocationId: the ID of the EIP.
Examples
-
JSON
format{ "ROSTemplateFormatVersion": "2015-09-01", "Description": { "en": "Create a VPC type ECS and bind EIP (existing 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.", }, "Label": { "en": "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>", </font>" }, "Label": { "en": "VSwitch 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.", </font>" }, "Label": { "en": "Business Security Group ID", }, "AssociationPropertyMetadata": { "VpcId": "VPC" } }, "ECSPassword": { "NoEcho": true, "Type": "String", "Description": { "en": "Server login password, Length 8-30, must contain three (Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).", }, "AllowedPattern": "[0-9A-Za-z\\_\\-\\&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$", "Label": { "en": "Instance Password", }, "MinLength": 8, "ConstraintDescription": { "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).", }, "MaxLength": 30, "Default": null }, "EIPInternetChargeType": { "Type": "String", "AllowedValues": [ "PayByBandwidth", "PayByTraffic" ], "Description": { "en": "The charge type of EIP, PayByBandwidth;PayByTraffic.", }, "Label": { "en": "EIP Charge Type", }, "Default": "PayByTraffic" }, "ECSImageId": { "Type": "String", "AssociationProperty": "ALIYUN::ECS::Instance::ImageId", "Description": { "en": "Image ID,Please use Centos7.", }, "Label": { "en": "Image", }, "Default": "ubuntu_14" }, "ECSZoneId": { "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId", "Type": "String", "Description": { "en": "Availability zone ID.<br><b>Note: <font color='blue'>Before selecting, please confirm whether the availability zone supports the specification of creating ECS resources. It is recommended to be different from other switch availability zones</font></b ><br><font color='red'>The switch availability zone and the selected switch instance ID must be in the same availability zone.</font>", </font>" }, "Label": { "en": "VSwitch Availability Zone", } }, "EIPBandwidth": { "Type": "Number", "Description": { "en": "EIP Bandwidth, Value range: [1,200], unit: Mbps.", }, "MinValue": 1, "Label": { "en": "EIP Bandwidth", }, "MaxValue": 200, "Default": 1 }, "ECSInstanceType": { "AssociationPropertyMetadata": { "ZoneId": "ECSZoneId", "InstanceChargeType": "InstanceChargeType" }, "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>]", </font>]" }, "Label": { "en": "Instance Type", } }, "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>]", }, "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory", "AssociationPropertyMetadata": { "ZoneId": "ECSZoneId", "InstanceType": "ECSInstanceType" }, "Label": { "en": "System Disk Type", } }, "ECSSysDiskSize": { "Type": "Number", "Description": { "en": "System disk size, range of values: 40-500, units: GB.", }, "MinValue": 40, "Label": { "en": "System Disk Space", }, "MaxValue": 500, "Default": 40 }, "InstanceChargeType": { "Type": "String", "Label": { "en": "Instance Charge Type", }, "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>]", </font>]" }, "AllowedValues": [ "PostPaid", "PrePaid" ], "Default": "PostPaid" }, "KeyPairName": { "Type": "String", "AssociationProperty": "ALIYUN::ECS::KeyPair::KeyPairName", "Label": { "en": "Key Pair Name", }, "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>", </font>" }, "Default": null } }, "Metadata": { "ALIYUN::ROS::Interface": { "ParameterGroups": [ { "Parameters": [ "VPC", "VSwitch", "SecurityGroup" ], "Label": { "default": "VPC " } }, { "Parameters": [ "EIPBandwidth", "EIPInternetChargeType" ], "Label": { "default": "EIP" } }, { "Parameters": [ "ECSZoneId", "ECSImageId", "ECSInstanceType", "ECSDiskCategory", "ECSSysDiskSize", "InstanceChargeType", "ECSPassword", "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" }, "ZoneId": { "Ref": "ECSZoneId" }, "SystemDisk_Category": { "Ref": "ECSDiskCategory" }, "SecurityGroupId": { "Ref": "SecurityGroup" }, "VSwitchId": { "Ref": "VSwitch" }, "MaxAmount": 1, "SystemDisk_Size": { "Ref": "ECSSysDiskSize" }, "VpcId": { "Ref": "VPC" }, "ImageId": { "Ref": "ECSImageId" }, "InstanceType": { "Ref": "ECSInstanceType" }, "AllocatePublicIP": "false", "Password": { "Ref": "ECSPassword" }, "KeyPairName": { "Ref": "KeyPairName" } } }, "ElasticIp": { "Type": "ALIYUN::VPC::EIP", "Properties": { "Bandwidth": { "Ref": "EIPBandwidth" }, "InternetChargeType": { "Ref": "EIPInternetChargeType" } } }, "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" ] } } } }