Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 9: Domain Names, DNS and Subdomains

9.4 Before you point a domain: prepare the server

Friends, the server must be ready before you point a domain. Does the website work on the IP, is there an Elastic IP, and are ports 80/443 open – these three checks come first.

  1. A working website on EC2, tested with curl -I http://localhost and http://<PUBLIC_IP> (Chapters 7 and 8).
  2. 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 ::/0 for 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).

Ravindra Bagale's Tip

Many students point the domain at the auto-assigned public IP and stop the instance at night. In the morning the IP has changed and the domain points to someone else's server. Always put only an Elastic IP in DNS – and see section 14.1 for what an Elastic IP costs.

Lab

Chala, tumchya web server la Elastic IP attach kara aani curl -I http://<ELASTIC_IP> ne 200 yetoy ka te bagha. Mag security group madhe HTTP 80 aani HTTPS 443 che rules aahet ka te check kara, aani Elastic IP kagdavar liha – pudhchya lessons madhe lagel.

Got it? Website running, Elastic IP attached, 80/443 open – once this preparation is done, pointing a domain is only a few minutes of work. Now let's move on to buying a domain.