全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::VPC::EIPAssociation

更新時間:Apr 10, 2025

ALIYUN::VPC::EIPAssociation用於為雲產品執行個體綁定Elastic IP Address(EIP)。

文法

{
  "Type": "ALIYUN::VPC::EIPAssociation",
  "Properties": {
    "AllocationId": String,
    "InstanceId": String,
    "PrivateIpAddress": String,
    "Mode": String
  }
}         

屬性

屬性名稱類型必須允許更新描述約束
AllocationIdStringElastic IP Address的ID。
InstanceIdString雲產品執行個體的ID。支援以下雲產品執行個體類型:
  • VPC類型的ECS執行個體。
  • VPC類型的SLB執行個體。
  • NAT Gateway。
  • 高可用虛擬IP(HaVip)。
  • 彈性網卡。
PrivateIpAddressString交換器網段內的一個私網IP地址。如果不指定該參數,系統將根據VPC ID和交換器ID自動分配一個私網IP地址。
ModeString繫結模式。取值:
  • NAT(預設值):NAT模式(普通模式)。
  • MULTI_BINDED:多EIP網卡可見度模式。
  • BINDED:EIP網卡可見度模式。

傳回值

Fn::GetAtt

  • EipAddress:Elastic IP Address的地址。
  • AllocationId:Elastic IP Address的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: Virtual Private Cloud執行個體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": "Virtual Private Cloud執行個體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"
            ]
          }
        }
      }
    }