Retain an elastic network interface when releasing an instance

Updated at:

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.

Supported regions for primary ENI retention

Area

Region name

Region ID

Asia-Pacific - China

China (Ulanqab)

cn-wulanchabu

China (Shenzhen)

cn-shenzhen

China (Guangzhou)

cn-guangzhou

China (Chengdu)

cn-chengdu

China (Hong Kong)

cn-hongkong

China (Hohhot)

cn-huhehaote

China (Zhangjiakou)

cn-zhangjiakou

China (Hangzhou)

cn-hangzhou

China (Qingdao)

cn-qingdao

China (Beijing)

cn-beijing

China (Shanghai)

cn-shanghai

China (Heyuan)

cn-heyuan

Asia-Pacific - Other

Singapore

ap-southeast-1

Malaysia (Kuala Lumpur)

ap-southeast-3

Indonesia (Jakarta)

ap-southeast-5

Philippines (Manila)

ap-southeast-6

Thailand (Bangkok)

ap-southeast-7

Japan (Tokyo)

ap-northeast-1

South Korea (Seoul)

ap-northeast-2

Europe & Americas

US (Silicon Valley)

us-west-1

Germany (Frankfurt)

eu-central-1

UK (London)

eu-west-1

US (Virginia)

us-east-1

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

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

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

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.