EC2 IP Addresses
Types of IP Addresses in EC2
| Type | Scope | Static? | Charges? | Use Case |
|---|---|---|---|---|
| Private IP | Internal | ✔ Yes | ❌ No | Internal VPC communication |
| Public IP | Internet | ❌ No | ❌ No | Quick internet access |
| Elastic IP (EIP) | Internet | ✔ Yes | ⚠️ Yes | Static access, failover setups |
| IPv6 | Internet | ✔ Yes | ❌ No | Global routing, IPv6 access |

How to Connect
ssh -i mypem.pem aws-user@hostnameWarning
SG must have ssh inbound Rule
How to Check Public IP? ( AutoAssigned or EIP )
[ec2-user@ip-172-31-7-13 ~]$ curl ipinfo.io{
"ip": "3.7.70.216",
"hostname": "ec2-3-7-70-216.ap-south-1.compute.amazonaws.com",
"city": "Mumbai",
"region": "Maharashtra",
"country": "IN",
"loc": "19.0728,72.8826",
"org": "AS16509 Amazon.com, Inc.",
"postal": "400017",
"timezone": "Asia/Kolkata",
"readme": "https://ipinfo.io/missingauth"
}How to Check Private IP?
ifconfigor
[ec2-user@ip-172-31-7-13 ~]$ hostname -I
172.31.7.13