Ravindra BagaleCourses & study guides

Guides

How to Connect a GoDaddy Domain to AWS EC2

To connect a GoDaddy domain to AWS EC2, attach an Elastic IP to the instance, then in GoDaddy's DNS page set the A record for @ to that Elastic IP and make sure the CNAME www points to @. Add both names to server_name in Nginx (or ServerName/ServerAlias in Apache) and reload. Check with dig example.com +short; a changed A record usually works within minutes.

Friends, if you want to send her the link, http://13.233.10.25 won't do – you need a proper domain! In this guide we point a domain from GoDaddy to the EC2 server. GoDaddy stays both the registrar and the DNS – the simplest way. The same steps work for any .com or .in domain.

Quick answer

In GoDaddy → My Products → your domain → DNS, make the records look like this (13.233.10.25 = your Elastic IP), then configure the server and verify:

Type Name Value TTL
A @ 13.233.10.25 600 seconds
CNAME www @ 1 hour
dig example.com +short            # expect your Elastic IP
dig www.example.com +short        # expect example.com. then your Elastic IP
curl -I http://example.com        # expect HTTP/1.1 200 OK

What do I need before pointing a domain to EC2?

  1. A working website on EC2, tested with curl -I http://localhost and http://<PUBLIC_IP> — see How to Host a Static Website on EC2 with Nginx.
  2. An Elastic IP on the instance, so the address never changes after stop/start — see How to Attach an Elastic IP to an EC2 Instance. Never point DNS to the auto-assigned public IP: it may soon belong to someone else's instance.
  3. Security group: inbound HTTP 80 and HTTPS 443 from 0.0.0.0/0 — see How to Open Port 80 and 443.
  4. A domain in your GoDaddy account (My Products / Domain Portfolio). When you buy one, you only need the domain — hosting, email or SSL add-ons are not needed for EC2.

How does a GoDaddy domain find your EC2 server?

How a GoDaddy domain finds your EC2 server The browser asks a DNS resolver for example.com. The resolver asks a root server, then the .com servers, which point to GoDaddy's name servers. GoDaddy's DNS answers with the A record 13.233.10.25, the Elastic IP. The browser then connects to the EC2 instance and sends Host: example.com. Browser example.com ? DNS resolver Root server .com servers GoDaddy DNS ns51.domaincontrol.com EC2 web server Elastic IP 1 2 3 4 A example.com → 13.233.10.25 5 HTTP request, Host: example.com

The browser asks a DNS resolver. The resolver asks the root and .com servers, which point to GoDaddy DNS. GoDaddy answers with the A record (your Elastic IP), and the browser connects to EC2.

The browser asks a DNS resolver; the resolver follows the root and .com servers to the authoritative name servers of your domain (GoDaddy's, such as ns51.domaincontrol.com). They answer with your A record, and the browser connects to that IP and sends Host: example.com, so the web server knows which site you want.

How do I point a GoDaddy domain to EC2?

Step 1 — Open the DNS page in GoDaddy

My Products → Domains → click your domain → DNS (or Manage DNS). The GoDaddy website changes its look from time to time, so the button names may vary slightly; the flow stays the same.

Step 2 — Set the A record for @

In the DNS Records list, find the A record with name @ (a new domain usually points it to GoDaddy's "Parked" page). Click Edit (pencil icon) → Value / Points to = your Elastic IP, e.g. 13.233.10.25 → TTL = 600 seconds (or Custom → 600) → Save.

Step 3 — Point www to the root domain

Find the CNAME record www and make sure its value is @ (meaning example.com). If it is missing: Add New Record → CNAME, Name www, Value @.

Step 4 — Remove parking and forwarding

Delete any extra A records for @ that still point to parking or forwarding IPs, and turn off Forwarding if it was enabled. Leave NS, SOA and any MX/TXT records (email, verification) as they are.

Ravindra Bagale's Tip

Many students add the new A record but leave GoDaddy's old "Parked" A record in place. Then visitors land sometimes on your site and sometimes on the parking page – and you think DNS "works sometimes, sometimes not". Keep only one A record for @ and turn Forwarding off.

Step 5 — Tell the web server your domain name

DNS brings visitors to your IP; the web server must now recognise the name. For Nginx on Amazon Linux 2023:

sudo tee /etc/nginx/conf.d/example.conf > /dev/null <<'NGINX'
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    root /var/www/example;
    index index.html;
    location / { try_files $uri $uri/ =404; }
}
NGINX
sudo mkdir -p /var/www/example && echo '<h1>example.com is live!</h1>' | sudo tee /var/www/example/index.html
sudo nginx -t && sudo service nginx reload

If you already have a site with the public IP in server_name (for example /etc/nginx/conf.d/mysite.conf), just replace the IP with example.com www.example.com. For Apache use ServerName example.com and ServerAlias www.example.com in the <VirtualHost *:80>, then sudo apachectl configtest && sudo service httpd reload.

Step 6 — Verify with dig and curl

dig example.com +short                  # A record → 13.233.10.25
dig www.example.com +short              # CNAME chain → example.com. → 13.233.10.25
dig @8.8.8.8 example.com +short         # ask Google's public resolver
curl -I http://example.com              # DNS + web server together

dig comes from bind-utils on Amazon Linux (sudo yum install -y bind-utils); on Windows use nslookup example.com. When http://example.com opens your site, the domain is connected! 🎉 Next step: the padlock — How to Install a Free SSL Certificate on EC2.

Ravindra Bagale's Tip

💡 When the domain "doesn't work", split the problem in two: dig example.com +short tells you whether DNS is right, and curl -I http://13.233.10.25 -H "Host: example.com" tells you whether the web server is right. If both pass, only your laptop has an old cache – wait for the TTL or flush the cache.

How long does GoDaddy DNS take to update?

A changed A record usually works within minutes. TTL (Time To Live) is how many seconds resolvers may cache a record: with TTL 600, a resolver that saw the old value may keep it for up to 10 minutes. A name server change at the registrar can take longer, sometimes a few hours. Flush the cache on your laptop if the server already shows the new IP but your browser doesn't:

OS Command
Windows ipconfig /​flushdns
macOS sudo dscacheutil -​flushcache; sudo killall -​HUP mDNSResponder
Linux (systemd-resolved) resolvectl flush-​caches

Using Route 53 for DNS instead? Keep the domain at GoDaddy, create a public hosted zone in Route 53 and enter its four name servers under GoDaddy → DNS → Nameservers → Change nameservers. After that, records in GoDaddy's DNS page are ignored.

How do I fix common domain problems?

Ghabru naka 😅 — use this as a checklist:

Symptom Likely cause Fix
dig returns nothing / NXDOMAIN Record missing, typo, domain not verified or expired Check the DNS page; click the registrant verification email
dig shows the old/parking IP Old A record still there, TTL not expired, forwarding on Delete the parked A record; turn off forwarding; dig @8.8.8.8
Records correct in GoDaddy but not used Name servers point elsewhere (e.g. Route 53) dig NS example.​com +short; edit records where NS points
Domain resolves, browser times out Security group; wrong Elastic IP curl -​I http://<ELASTIC_​IP>; open 80/443
Domain shows the welcome page Name missing in server_name / ServerName Add both names; sudo nginx -T; reload
www works but the root doesn't (or reverse) One record or one name missing A @ + CNAME www; list both in server_name
Works on mobile data, not on the laptop Local DNS cache Flush the cache (table above)

Got it? DNS is the address, and server_name is the name on the door – only when both match does the visitor reach the right house. Once the domain works, next we add HTTPS and the padlock.

Frequently asked questions

How do I point my GoDaddy domain to an AWS EC2 instance?

In GoDaddy DNS set the A record for @ to your EC2 Elastic IP and make sure the CNAME www points to @. Then add the domain to server_name on the server and reload.

Why should I use an Elastic IP for my domain?

The auto-assigned public IP changes on every stop/start, so the domain would point to an address that may soon belong to someone else's instance. An Elastic IP stays the same.

How long does a GoDaddy DNS change take?

A changed A record usually works within minutes, but resolvers may keep the old answer until its TTL expires. A name server change can take a few hours. Check with dig @8.8.8.8 example.com +short.

Can I use a CNAME for the root domain?

No. A CNAME cannot be used at the apex (@). Use an A record for the root domain and a CNAME for names like www.

Should I use GoDaddy DNS or Route 53?

GoDaddy DNS is the simplest: the domain and the records stay in one place. Route 53 suits companies that run on AWS; you keep the domain at GoDaddy and change the name servers to the four Route 53 name servers.

My domain shows the Nginx welcome page. Why?

DNS works, but the web server does not know the name. Add both example.com and www.example.com to server_name (or ServerName and ServerAlias), then test and reload.