Amazon EC2 SAA 高频

EC2 Network Identity: IPs, Elastic IPs, and ENIs

EC2 Network Identity: IP Addresses and Elastic Network Interfaces

EC2ENIElastic IPnetworking
Last organized

Understand how EC2 instances, ENIs, private and public addresses, and Elastic IPs behave across lifecycle events.

In one sentence

EC2 provides compute; an ENI carries network identity. Private IPs, MAC addresses, and security groups primarily follow the ENI, while an Elastic IP is a fixed public IPv4 address that can be reassociated.

Addresses and interfaces

ObjectPurposeLifecycle behavior
Private IPv4Communication inside a VPCThe primary private IP normally survives stop/start
Auto-assigned public IPv4Temporary public identityReleased on stop or hibernate and usually changes after start
Elastic IPFixed public IPv4Can be reassociated; unused or attached addresses may incur cost
ENIVirtual NIC and network identityBelongs to one subnet and therefore one AZ
Secondary private IPAn extra address on the same ENIIt is not a second network card
Secondary ENIA separate additional interfaceCan move between compatible instances in the same AZ

A public address alone does not make an instance reachable. The IGW route, security controls, host firewall, and application listener must also be correct.

Design patterns

  • Fixed public entry for one resource: Elastic IP; at scale, prefer DNS and load balancing.
  • Fixed egress address: private EC2 → NAT Gateway + Elastic IP.
  • Same-AZ network identity failover: move a secondary ENI and retain its private IP, MAC, and security groups.
  • NAT, router, or firewall appliance: source/destination checks normally need to be disabled.
  • Extra ENIs separate responsibilities and paths; they do not automatically double bandwidth.

Remember

An IP identifies an address; an ENI owns the network identity. ENI failover cannot cross AZs, so it is not complete Multi-AZ high availability.