"The IP address belongs to the server." Not exactly. In AWS the address belongs to a network interface, and the interface is attached to the server. That sounds like a detail, but it changes how you design for failure, and it explains a lot of what you see in the EC2 console.
What a network interface is
An elastic network interface (ENI) is a virtual network card inside a VPC. The console and the API simply call it a network interface. It is created in one subnet, so it lives in one Availability Zone, and you attach it to an instance in that same zone.
The interface carries the network identity:
- a primary private IPv4 address from the subnet's range, plus optional secondary private addresses
- optional Elastic IP addresses, one per private IPv4 address
- IPv6 addresses, if the subnet has them
- a MAC address
- its security groups
- a source/destination check flag
Notice that security groups are on this list. A security group protects a network interface, which is why one instance with two interfaces can have two different sets of rules.
Primary and secondary interfaces
Every instance has a primary network interface. You can't detach it.
You can create and attach secondary interfaces. How many depends on the instance type. And a secondary interface can be moved: detach it from one instance, attach it to another in the same Availability Zone, and its attributes follow it. The private address, the Elastic IP and the security groups arrive on the new instance, and traffic is redirected there.
That enables a few useful designs:
- a management network on a separate interface and subnet from the application traffic
- a low-cost failover, where a standby instance takes over the interface of a failed one
- network and security appliances with one interface in each of several subnets
One thing to remember for appliances: the source/destination check is on by default. An instance that forwards traffic for others, such as a NAT instance or a firewall, needs it turned off.
Interfaces you didn't create
Many AWS services place interfaces in your VPC on your behalf. A NAT gateway, a Lambda function connected to a VPC, an RDS database, a load balancer and an interface VPC endpoint all show up as network interfaces. AWS calls these requester-managed: you can see them, but the service controls them.
So when your subnet runs short of IP addresses, or you find interfaces in the console that nobody remembers creating, check the description: it usually names the service that owns it.
Where AI fits
Training a large model on several GPU servers only works if the servers can exchange data fast enough to behave like one machine. Often the network, not the GPU, is the limit.
For that, AWS offers the Elastic Fabric Adapter (EFA), a network device you attach to supported EC2 instance types. With EFA, AI and high performance computing applications talk to the device through the Libfabric API, which bypasses the operating system kernel. The result is lower and more consistent latency between instances. Some large GPU instance types support several network cards, each of which can carry an EFA.
Two limits to plan around: EFA traffic can't cross Availability Zones or VPCs, and it isn't routable. The cluster has to sit together. AWS doesn't charge extra for EFA itself.
Quick recap
- A network interface holds the addresses, the MAC address and the security groups. The server just borrows them.
- The primary interface stays; secondary interfaces can move to another server in the same Availability Zone.
- Managed services use interfaces in your subnets too, and GPU clusters rely on a faster kind: the Elastic Fabric Adapter.