Chapter 9: Domain Names, DNS and Subdomains
9.4 Before you point a domain: prepare the server
- A working website on EC2, tested with
curl -I http://localhostandhttp://<PUBLIC_IP>(Chapters 7 and 8). -
An Elastic IP, so the address never changes after stop/start. Quick steps:
- EC2 console → Network & Security → Elastic IPs → Allocate Elastic IP address → Allocate.
- Select it → Actions → Associate Elastic IP address → choose your instance → Associate.
- Note the address, e.g.
13.233.10.25. SSH now uses this IP too.
(Charges, the default limit of 5 per region, moving an EIP to a replacement server and releasing it safely are covered in detail in section 14.1.) 3. Security group: inbound HTTP 80 and HTTPS 443 from
0.0.0.0/0(and::/0for IPv6).
Never point DNS to the auto-assigned public IP
It changes on every stop/start. Your domain would then point to an IP that may soon belong to someone else's instance. Always use an Elastic IP (or a load balancer).