A stopped-and-started EC2 instance changed its public IP and broke the DNS record. How do you prevent that?
BeginnerScenarioEC2, Auto Scaling and Load Balancing
Answer
Situation read → Auto-assigned public IPs are released on stop.
What I'd do →
- Put a load balancer in front and point DNS at it
- Or associate an Elastic IP
- Or use a Route 53 alias to the ALB
- Avoid pointing DNS at instance IPs
Why → Load balancer DNS names are stable endpoints that survive instance replacement.
Interview tip → Treat instances as cattle.