全部產品
Search
文件中心

:ALIYUN::ECS::NetworkInterfaceAttachment

更新時間:Feb 05, 2024

ALIYUN::ECS::NetworkInterfaceAttachment類型用於綁定彈性網卡(ENI)到Virtual Private Cloud類型執行個體上。

文法

  {
  "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樣本