All Products
Search
Document Center

Elastic Compute Service:Bind a secondary ENI

Last Updated:Oct 14, 2024

You can use elastic network interfaces (ENIs) to deploy high-availability clusters and perform low-cost failover and fine-grained network management. You can create a secondary ENI when you create an Elastic Compute Service (ECS) instance. Then, the secondary ENI is automatically bound to the instance. You can also separately create a secondary ENI and bind the secondary ENI to an ECS instance. This topic describes how to bind a secondary ENI to an ECS instance after you separately create the secondary ENI.

Prerequisites

  • The instance to which you want to bind a secondary ENI is an I/O optimized instance and is in the Stopped or Running state. Refer to Overview of instance families or call the DescribeInstanceTypes operation to view the performance data of a specific instance type. Refer to Best practices for selecting ECS instance types to learn how to select instance types.

    Secondary ENIs can be bound to instances of specific instance types only if the instances are in the Stopped state.

    Instance types for which instances must be in the Stopped state

    The following table describes the instance types. For more information, see Overview of instance families.

    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

    e, economy instance family

    ecs.e-c1m1.large, ecs.e-c1m2.large, and ecs.e-c1m4.large

    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

  • 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.

    Important

    You can restart an ECS instance in the ECS console or by calling the RebootInstance operation. You cannot restart an instance within the operating system.

  • A secondary ENI is created and is in the Available state. For more information, see Create a secondary ENI.

  • The secondary ENI must reside in the same virtual private cloud (VPC) and zone as the instance to which you want to bind the secondary ENI.

Background information

  • Bind a secondary ENI when you create an instance

    When you create an ECS instance in the ECS console, you can add ENIs to the ECS instance. The ENIs are automatically assigned IP addresses and bound to the ECS instance without the need to perform additional operations. You can add up to two ENIs: a primary ENI and a secondary ENI. If the secondary ENI is bound to the instance before you release the instance, the secondary ENI is released together with the instance.

    Note

    For specific instance types, you can bind secondary ENIs only after you create instances. For more information, see Overview of instance families.

  • Separately create a secondary ENI and bind it to an ECS instance

    If you do not bind a secondary ENI to an instance when you create the instance and separately create one or more secondary ENIs, bind a secondary ENI to the instance in the ECS console or by calling an API operation.

Limits

A secondary ENI can be bound to only one ECS instance at a time. An ECS instance can have multiple secondary ENIs. For more information about the number of ENIs that is supported by each instance type, see Overview of instance families.

Procedure

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Network & Security > Elastic Network Interfaces.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. Find an available secondary ENI and click Bind to Instance in the Actions column.

    1. In the Bind to Instance dialog box, select an instance and click Confirm.

      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.

What to do next

After you separately create a secondary ENI and bind the secondary ENI to an ECS instance, some images may not automatically identify the IP address of the secondary ENI and add routes. In this case, you cannot use the secondary ENI. To resolve this issue, configure a secondary ENI in the ECS instance to identify the IP address. For more information, see Configure a secondary ENI.

References

  • You can assign a secondary private IP address to a secondary ENI in scenarios such as multi-application, failover, and load balancing. For more information, see Assign secondary private IP addresses.

  • You can call the RunInstances operation to create one or more pay-as-you-go or subscription ECS instances. For more information, see RunInstances.

  • Call the CreateInstance operation to create a subscription or pay-as-you-go ECS instance. For more information, see CreateInstance.

  • Call the AttachNetworkInterface operation to bind an ENI to an ECS instance in a VPC. For more information, see AttachNetworkInterface.