ENI Flashcards
What is an ENI?
An ENI is a decoupling of the network card to an EC2 instance. In other words, it’s a logical component in a VPC that represents a virtual network card.
What is an elastic IP?
It’s a fixed IP that you attach to an instance. You’re limited to a small number of elastic IPs and pay a monthly fee for them. They are always ipv4.
Use case is to compensate for the fact that an instance’s public IP can change every time it’s shut down.
Try to avoid these whenever possible; it’s better to use a DNS name or load balancer.
What attributes does an ENI have? How many IPs does it have?
Kinda like typical network cards, it has a MAC address.
Can only have one ipv4, and one or more ipv6.
Are ENIs global?
No; just like EC2 instances they’re bound to an AZ.
What if I don’t assign an ENI to a new EC2 instance?
It’s created for you automatically, with a “delete on terminate” flag to delete it when you terminate the EC2 instance.
What are ENI useful for?
Here’s a big one:
It makes the idea of the idea of launching an EC2 instance on a particular VPC subnet effectively obsolete. You can attach two different ENIs to an instance, each one on a distinct subnet. The ENI (not the instance) is now associated with the subnet.
Other things you can do:
- ENIs can be attached on the fly to EC2 instances
- You can create a dual-homed environment for your web, application, and database servers. The instance’s first ENI would be attached to a public subnet, routing 0.0.0.0/0 (all traffic) to the VPC’s Internet Gateway. The instance’s second ENI would be attached to a private subnet, with 0.0.0.0 routed to the VPN Gateway connected to your corporate network. You would use the private network for SSH access, management, logging, and so forth. You can apply different security groups to each ENI so that traffic port 80 is allowed through the first ENI, and traffic from the private subnet on port 22 is allowed through the second ENI.
- You can host load balancers, proxy servers, and NAT servers on an EC2 instance, carefully passing traffic from one subnet to the other. In this case you would clear the Source/Destination Check Flag to allow the instances to handle traffic that wasn’t addressed to them. We expect vendors of networking and security products to start building AMIs that make use of two ENIs.
- Low-budget HA (if EC2 instance dies, spin up a new one and attach the ENI to it)
- Might matter for Mac-based licensing
How many ENIs can I attach to an EC2 instance?
Minimum 1, maximum 2.