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

PropertyTypeRequiredEditableDescriptionConstraint
AllocationIdStringYesYesThe ID of the EIP. None.
InstanceIdStringYesYesThe ID of the cloud service instance. The following types of instances are supported:
  • Elastic Compute Service (ECS) instances of the virtual private cloud (VPC) type
  • Server Load Balancer (SLB) instances of the VPC type
  • NAT gateways
  • High-availability virtual IP addresses (HAVIPs)
  • Elastic network interfaces (ENIs)
PrivateIpAddressStringNoYesThe private IP address in the CIDR block of the vSwitch. If you do not specify this property, the system allocates a private IP address based on the VPC ID and the vSwitch ID.
ModeStringNoYesThe association mode. Default value: NAT. Valid values:
  • NAT: standard NAT mode
  • MULTI_BINDED: multi-EIP-to-ENI mode
  • BINDED: cut-through mode

Return values

Fn::GetAtt

  • EipAddress: the EIP.
  • AllocationId: the ID of the EIP.

Examples

  • YAML 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}
      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>]
              </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:
          InstanceType: ${ECSInstanceType}
        Label:
          en: System Disk Type
           
      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:
              - 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 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}"
          }
        },
        "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>]",
                </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": {
            "InstanceType": "${ECSInstanceType}"
          },
          "Label": {
            "en": "System Disk Type",
             
          }
        },
        "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": [
                "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"
            ]
          }
        }
      }
    }