All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::NetworkInterfaceAttachment

Last Updated:Dec 12, 2023

ALIYUN::ECS::NetworkInterfaceAttachment is used to bind an elastic network interface (ENI) to an Elastic Compute Service (ECS) instance in a virtual private cloud (VPC).

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

InstanceId

String

Yes

No

The instance ID.

None.

NetworkInterfaceId

String

Yes

No

The ENI ID.

None.

TrunkNetworkInstanceId

String

No

No

The ID of the trunk network interface.

None.

EcsRestartOption

String

No

No

Specifies whether to restart the ECS instance when you bind an ENI to the ECS instance

Valid values:

  • Auto

  • NotRestart

  • Restart

Return values

Fn::GetAtt

  • NetworkInterfaceId: the ENI ID.

  • TrunkNetworkInstanceId: the ID of the trunk network interface.

  • InstanceId: the instance ID.

Examples

  • YAML format

    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 format

    {
      "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"
            ]
          }
        }
      }
    }

For more examples, visit NetworkInterfaceAttachment.json and NetworkInterfaceAttachment.yml. In the examples, the following resource types are used: ALIYUN::ECS::NetworkInterface, ALIYUN::ECS::NetworkInterfaceAttachment, and ALIYUN::ECS::NetworkInterfacePermission.