When you release an Elastic Compute Service (ECS) instance, all attached Elastic Network Interfaces (ENIs) -- both primary and secondary -- are released by default. To preserve an ENI and its associated resources (private IP addresses, IPv6 addresses, Elastic IP Address (EIP) associations, security group memberships, and route table entries), disable Delete on instance release during instance creation or at any time afterward.
How it works
Each attached ENI is either released or retained based on its Delete on instance release setting:
| Resource | Released with the instance | Retained after instance release |
|---|---|---|
| Private IPv4 addresses and IPv4 prefixes | Released | Retained |
| Private IPv6 addresses, IPv6 prefixes, and IPv6 Internet bandwidth | Released | Retained |
| Elastic IP Address (EIP) | Dissociated (the EIP must be manually released or attached to another resource) | Attachment retained |
| Security group | Dissociated (related security group rules are not automatically deleted) | Association retained |
| Virtual Private Cloud (VPC) route table that points to the ENI | Deleted | Retained |
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.
Region availability for primary ENI retention
Secondary ENIs can be retained in all regions. Primary ENI retention is available only in the following regions.
Set the release behavior of an ENI
Console
Find the target ENI using one of the following methods:
Go to the Instances page. Click the instance ID to open the instance details page, click the ENIs tab, and locate the ENI.
Go to the Elastic Network Interfaces page and locate the ENI directly.
In the Instance column, enable or disable Delete on instance release to control whether the ENI is released with the instance.
API
| API | Parameter | Description |
|---|---|---|
| CreateNetworkInterface | DeleteOnRelease | Set the release behavior when creating an ENI. |
| ModifyNetworkInterfaceAttribute | DeleteOnRelease | Update the release behavior of an existing ENI. |
| DescribeNetworkInterfaceAttribute | DeleteOnRelease | Query the current release behavior. |
Reuse a retained ENI
After an instance is released, retained ENIs remain available in the same zone. Attach a retained ENI to another instance using one of the following methods: