Retain an elastic network interface when releasing an instance
By default, when you release an instance, its attached elastic network interfaces (ENIs) are also deleted. You can configure an ENI to be retained when its instance is released. This allows you to attach the ENI to a new instance and reuse its network configuration, such as its IP addresses, routes, MAC address, and security group memberships. Reusing the configuration reduces setup time for instance replacements or failovers.
Limitations
Secondary ENIs can be retained in all regions. Primary ENI retention is currently available only in specific regions.
Configure ENI retention
When you release an instance, your choice to retain or delete an ENI affects the following associated resources:
|
Resource |
Released with instance |
Retained after release |
|
Private IPv4 addresses and IPv4 prefixes |
Released |
Retained |
|
Private IPv6 addresses, IPv6 prefixes, and IPv6 Internet bandwidth |
Released |
Retained |
|
EIP |
Disassociated. You must manually release the EIP or attach it to another resource. |
Association retained |
|
security group |
Disassociated. The system does not automatically delete the related security group rules. |
Association retained |
|
Entries in a Virtual Private Cloud (VPC) route table that point to the ENI |
Deleted |
Retained |
Console
-
Locate the target ENI in one of the following ways:
-
Go to the ECS console and click the ID of the target instance to go to the instance details page. On the instance details page, switch to the ENIs tab and find the target ENI in the ENIs list.
-
Go to the ECS Console - Elastic Network Interfaces page and find the target ENI in the ENIs list.
-
-
In the Instance column, enable or disable Delete on instance release as needed.
A retained primary ENI becomes a secondary ENI. When you create a new instance, you can assign this ENI as the primary ENI of that instance.
API
-
When you call the CreateNetworkInterface operation to create an elastic network interface, use the
DeleteOnReleaseparameter to set its release policy. -
Call ModifyNetworkInterfaceAttribute and use the
DeleteOnReleaseparameter to modify the network interface's release policy. -
Call DescribeNetworkInterfaceAttribute to query the release policy of the network interface. The
DeleteOnReleasefield indicates the release policy.
Attach an ENI to an instance
You can reuse a retained ENI. In the same zone, you can attach it to an existing instance or attach it during instance creation.