Public IP, Elastic IP and private IP: how do they differ on EC2?
BeginnerScenarioVPC & Cloud Network Design
Answer
Situation read → Interviewers check whether you know which survives a stop/start.
What I'd do →
- Private IP stays with the instance for life in the VPC and is used for internal traffic
- Auto-assigned public IPv4 is released on stop and changes on start
- Elastic IP is a static public address you own until you release it and can remap to another instance or ENI
- Check with
aws ec2 describe-addresses
Why → Public addressing is a pool resource; only an Elastic IP is stable.
Interview tip → Mention that idle or unattached Elastic IPs and all public IPv4 addresses are billed now, so you clean them up.
More on VPC & Cloud Network Design
What makes a subnet public versus private in AWS?BeginnerExplain internet gateway versus NAT gateway and when you use each.BeginnerPrivate instances need to pull packages from the internet but must not be reachable from it. What do you set up?BeginnerWhy shouldn't production run in the default VPC?BeginnerWhy use SSM Session Manager instead of a bastion host?BeginnerYour private subnet instances reach S3 through the NAT gateway and the bill is large. What do you do?Beginner