ALIYUN::ECS::NetworkInterfaceAttachment

ALIYUN::ECS::NetworkInterfaceAttachment类型用于绑定弹性网卡(ENI)到专有网络(VPC)类型实例上。

语法

  {
  "Type": "ALIYUN::ECS::NetworkInterfaceAttachment",
  "Properties": {
    "InstanceId": String,
    "NetworkInterfaceId": String,
    "TrunkNetworkInstanceId": String,
    "EcsRestartOption": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

InstanceId

String

实例ID。

NetworkInterfaceId

String

弹性网卡ID。

TrunkNetworkInstanceId

String

Trunk网卡ID。

EcsRestartOption

String

控制绑定弹性网卡时是否重启ECS实例。

取值:

  • Auto

  • NotRestart

  • Restart

返回值

Fn::GetAtt

  • NetworkInterfaceId:弹性网卡ID。

  • TrunkNetworkInstanceId:Trunk网卡ID。

  • InstanceId:实例ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      InstanceId:
        Type: String
        AssociationProperty: ALIYUN::ECS::Instance::InstanceId
      NetworkInterfaceId:
        Type: String
        Description: Network interface id
    Resources:
      EniAttachment:
        Type: ALIYUN::ECS::NetworkInterfaceAttachment
        Properties:
          InstanceId:
            Ref: InstanceId
          NetworkInterfaceId:
            Ref: NetworkInterfaceId
    Outputs:
      TrunkNetworkInstanceId:
        Description: ID of Trunk Network Interface.
        Value:
          Fn::GetAtt:
            - EniAttachment
            - TrunkNetworkInstanceId
      NetworkInterfaceId:
        Description: ID of your Network Interface.
        Value:
          Fn::GetAtt:
            - EniAttachment
            - NetworkInterfaceId
      InstanceId:
        Description: ID of instance.
        Value:
          Fn::GetAtt:
            - EniAttachment
            - InstanceId
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "InstanceId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::Instance::InstanceId",
        },
        "NetworkInterfaceId": {
          "Type": "String",
          "Description": "Network interface id"
        }
      },
      "Resources": {
        "EniAttachment": {
          "Type": "ALIYUN::ECS::NetworkInterfaceAttachment",
          "Properties": {
            "InstanceId": {
              "Ref": "InstanceId"
            },
            "NetworkInterfaceId": {
              "Ref": "NetworkInterfaceId"
            }
          }
        }
      },
      "Outputs": {
        "TrunkNetworkInstanceId": {
          "Description": "ID of Trunk Network Interface.",
          "Value": {
            "Fn::GetAtt": [
              "EniAttachment",
              "TrunkNetworkInstanceId"
            ]
          }
        },
        "NetworkInterfaceId": {
          "Description": "ID of your Network Interface.",
          "Value": {
            "Fn::GetAtt": [
              "EniAttachment",
              "NetworkInterfaceId"
            ]
          }
        },
        "InstanceId": {
          "Description": "ID of instance.",
          "Value": {
            "Fn::GetAtt": [
              "EniAttachment",
              "InstanceId"
            ]
          }
        }
      }
    }

更多示例,请参见创建一个弹性网卡、绑定弹性网卡到专有网络类型实例和授权弹性网卡的组合示例:JSON示例YAML示例