Key Properties of ENIs
An ENI represents a logical version of a physical network card in a VPC. Its main properties include:- A primary private IPv4 address automatically selected from the subnet’s CIDR block.
- Optionally, a primary IPv6 address.
- Secondary private IPv4 addresses.
- The ability to associate an Elastic IP address.
- Public IP address allocation when enabled.
- A unique MAC address.
- Configurable flags like the source/destination check.

Primary vs. Secondary ENIs
When you launch an Amazon EC2 instance, it automatically receives a primary ENI, typically named Ethernet0. This primary ENI comes with a primary private IPv4 address sourced from the associated subnet. It remains attached to the instance for its lifetime and cannot be detached—even during instance stops or restarts—and is deleted when the instance is terminated. Additionally, if your subnet configuration auto-assigns public IP addresses, this ENI will obtain a public IP address as well.The primary ENI is permanently linked to its instance. Secondary ENIs, however, can be detached and reattached, making them ideal for scenarios like network appliances or management networks.
- They can be attached to or detached from EC2 instances as needed.
- They can host a primary private IP along with multiple secondary private IP addresses.
- They may have different security groups compared to the primary ENI, allowing for distinct network and security configurations.


Elastic IP Addresses and Security Groups
You can associate an Elastic IP address with an ENI, which guarantees that the IP remains constant even if the ENI is detached and later reattached to a different instance. Moreover, security groups can be directly linked to an ENI, allowing granular control over the traffic at the interface level.Benefits of Using ENIs
ENIs offer several powerful features for designing flexible and secure network architectures on AWS:
Summary
ENIs are robust and versatile components of Amazon EC2 that help you:- Decouple network configurations from compute instances.
- Leverage multiple IP addressing schemes.
- Configure static IP addresses through Elastic IP associations.
- Implement specialized security configurations using dedicated security groups.
- Enhance operational flexibility by allowing dynamic attachment and detachment of network interfaces.