# Elastic Network Interface.

## **ENI stands for Elastic Network Interface.**

* Imagine your EC2 server is a house 🏠.
* To send letters or get pizza delivered, your house needs an address 🏷.
* An ENI is like that address — it’s how the internet and other machines know where to find your house in the cloud.
* You can take this address and move it to another house if you move — that’s why it’s *elastic*.

**Why it’s useful:**

1. Extra addresses – Your cloud house can have more than one address for different guests.
2. Move around – If one house breaks, you can move the same address to another house and people will still find you.
3. Private or public – You can have a secret address (private IP) for friends and a public one for everyone else.

💡 **In short:**

EC2 = House 🏠\
ENI = Address 📍\
Cloud = The whole neighborhood ☁️

### **Elastic IP (EIP)**

* Think of an Elastic IP as a special public phone number 📞 in the cloud.
* Anyone in the world can use it to call your cloud computer.

**Private IP**

* A Private IP is like a secret house address 🏠 inside your neighborhood (VPC).
* Only your friends inside the neighborhood can find it — strangers can’t.

### **AWS says:**

“If you want a public phone number (Elastic IP), you must attach it to a private IP address — and it’s one-to-one.”

**That means:**

* 1 Elastic IP can only be linked to 1 Private IP at a time.
* You can’t have one Elastic IP shared by multiple Private IPs directly.
* So traffic knows exactly where to go — no confusion.
* Makes it easier to move your Elastic IP to another server if the first one breaks.

Private IP = Your *secret* house number inside the playground 🏠.\
Elastic IP = The *public* phone number for calling you 📞.\
Rule = 1 phone number belongs to 1 house number — no sharing.

### **NAT stands for Network Address Translation**

* NAT Instance = An EC2 server configured to allow outbound internet access for private subnets, but block inbound traffic from the internet.
* Private EC2 → NAT Instance → Internet ✅
* Internet → NAT Instance → Private EC2 ❌

<mark style="color:red;">**Key points:**</mark>

* Used when private instances need to download stuff but stay hidden from the public internet.
* AWS now recommends NAT Gateways (a managed service) instead of NAT instances, but NAT instances are cheaper and customizable.
