You can use elastic network interfaces (ENIs) to deploy high-availability clusters and perform low-cost failover and fine-grained network management. This topic describes how to bind an ENI when you create an Elastic Compute Service (ECS) instance and how to create an ENI separately and bind it to an existing instance.

Prerequisites

  • If you want to bind an ENI when you create an instance, make sure that the required preparations are made. For more information, see Create an instance by using the wizard.
  • If you want to create an ENI separately and bind it to an existing instance, make sure that the following requirements are met:
    • The instance to which you want to bind an ENI is of an I/O optimized instance type and is in the Stopped or Running state.
      Note For specific instance types, secondary ENIs can be bound to instances only when the instances are in the Stopped state. For more information about instance types, see Instance types for which instances must be in the Stopped state.
    • The maximum number of ENIs that can be bound to the instance is not reached.
      Note An ENI can be bound to only a single ECS instance at a time. However, an ECS instance can have multiple ENIs. For information about the maximum number of ENIs that can be bound per instance for different instance types, see Instance family.
    • If the instance was last started, restarted, or reactivated before April 1, 2018 and has remained in the Running state since then, you must restart the instance before you can bind ENIs to it.
      Notice To restart an ECS instance, you must use the ECS console or call the RebootInstance operation. You cannot restart an instance from within the operating system.
    • An ENI is created and is in the Available state. For more information, see Create an ENI.
    • The instance and the ENI reside in the same virtual private cloud (VPC).
    • The instance and the ENI reside in the same zone.

Background information

You can use one of the following methods to bind an ENI to an instance:

After ENIs are created, deleted, bound to instances, or unbound from instances, ENI operation events are triggered. You can use CloudMonitor to set notifications of ENI operation events to obtain the ENI operation results such as whether ENIs are created. For more information, see ENI operation event notifications.

Bind an ENI when you create an instance

For information about how to create an instance, see Create an instance by using the wizard. If you want to bind an ENI when you create an instance, take note of the following configurations:
  • Basic configurations:
    • Region: ENIs are supported in all regions.
    • Instance Type: Select an I/O optimized instance type that allows ENIs to be bound during instance creation. For more information, see Instance families.
    • Image: ENIs can be automatically identified without additional configurations if you select one of the following images:
      • Alibaba Cloud Linux 3.2104 64-bit
      • CentOS 8.0 64-bit, CentOS 8.1 64-bit, and CentOS 8.2 64-bit
      • CentOS 7.3 64-bit, CentOS 7.4 64-bit, and CentOS 7.5 64-bit
      • CentOS 6.8 64-bit and CentOS 6.9 64-bit
      • Debian 10.5 64-bit and Debian 10.6 64-bit
      • Windows Server 2008 R2 and later

      If you select an image that is not in the preceding list, you must configure ENIs so that they can be identified after the instance is created. For more information, see Configure a secondary ENI.

  • Networking configurations:
    • Network Type: You must select VPC. Then, select a VPC and a vSwitch for the instance.
    • Elastic Network Interface: Click Add ENI to create an ENI. An ENI and the instance to which it is bound must reside within the same zone but do not need to connect to the same vSwitch.

After the instance is created, you can go to its Instance Details page and view the state of ENIs on the ENIs tab. If an ENI is bound to the instance, InUse is displayed in the Status/Creation Time column corresponding to the ENI.

Bind an ENI to an existing instance on the Instances page

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Find the instance to which you want to bind an ENI and choose More > Network and Security Group > Bind Secondary ENI in the Actions column.
  5. In the Bind Secondary ENI dialog box, select a secondary ENI and click OK.
    After you bind the ENI to the instance, you can go to the Instance Details page of the instance and view the state of the ENI on the ENIs tab. If the ENI is bound to the instance, InUse is displayed in the Status/Creation Time column corresponding to the ENI.

Bind an ENI to an existing instance on the Network Interfaces page

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Network & Security > ENIs.
  3. In the top navigation bar, select a region.
  4. Find an available secondary ENI and click Bind to Instance in the Actions column.
  5. In the Bind to Instance dialog box, select an instance and click OK.
    Refresh the ENI list. If the ENI is bound to the instance, InUse is displayed in the Status/Creation Time column corresponding to the ENI.

Bind an ENI to an existing instance on the Security Groups page

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Network & Security > Security Groups.
  3. In the top navigation bar, select a region.
  4. Find the security group to which an available ENI belongs and click Manage ENIs in the Actions column.
  5. On the ENIs in Security Group page, find the ENI and click Bind to Instance in the Actions column.
  6. In the Bind to Instance dialog box, select an instance and click OK.
    After you bind the ENI to the instance, you can choose the Network & Security > ENIs in the left-side navigation pane and view the state of the ENI on the Network Interfaces page. If the ENI is bound to the instance, InUse is displayed in the Status/Creation Time column corresponding to the ENI.

What to do next

For instances that use specific images, you may need to manually configure ENIs so that they can be identified by the instances. For more information, see Configure a secondary ENI.

Instance types for which instances must be in the Stopped state

For specific instance types, ENIs can be bound to or unbound from instances only when the instances are in the Stopped state. For more information, see Stop an instance.

The following table describes the instance types. For more information, see Instance family.
Instance family Instance type
s6, shared standard instance family ecs.s6-c1m1.small, ecs.s6-c1m2.large, ecs.s6-c1m2.small, ecs.s6-c1m4.large, and ecs.s6-c1m4.small
t6, burstable instance family ecs.t6-c1m1.large, ecs.t6-c1m2.large, ecs.t6-c1m4.large, ecs.t6-c2m1.large, and ecs.t6-c4m1.large
t5, burstable instance family ecs.t5-c1m1.large, ecs.t5-c1m2.large, ecs.t5-c1m4.large, ecs.t5-lc1m1.small, ecs.t5-lc1m2.large, ecs.t5-lc1m2.small, ecs.t5-lc1m4.large, and ecs.t5-lc2m1.nano
Previous-generation shared instance families xn4, n4, mn4, and e4
  • ecs.xn4.small
  • ecs.n4.small and ecs.n4.large
  • ecs.mn4.small and ecs.mn4.large
  • ecs.e4.small and ecs.e4.large