š What is an ENI (Elastic Network Interface) in AWS?
An Elastic Network Interface (ENI) is a virtual network card that can be attached to an EC2 instance in a VPC (Virtual Private Cloud). It allows the instance to connect to the network and can carry multiple IP addresses, security groups, and MAC address.
š§© Key Components of an ENI:
- Primary private IP address
- One or more secondary private IP addresses
- One Elastic IP (optional, for public access)
- One or more security groups
- MAC address
- Description and tags
šÆ Why Use ENIs?
Use Case | Benefit |
---|---|
Multiple ENIs per instance | Enables separation of traffic (e.g., frontend/backend) |
Move ENIs between instances | Fast failover / disaster recovery |
Attach to Lambda or ECS with ENI | Enable VPC networking |
Create virtual appliances | ENIs act like virtual firewalls, routers, etc. |
š¦ Types of ENIs:
Type | Use Case |
---|---|
Primary ENI | Comes attached to EC2 by default |
Secondary ENI | Manually attach for extra traffic routing or HA setup |
š ļø CLI Example: Create and Attach ENI
š ENI in Failover:
You can detach an ENI from a failed instance and reattach it to a standby instance ā this retains the IP address and network configuration, providing minimal disruption.