Route 53

Route 53 is the built in DNS (Domain Name System) for AWS.

  • translates URL web addresses into IP addresses (198.143.164.252)
  • register domain name




1) When a website’s domain name is entered into your browser, the device queries a DNS recursive resolver (which finds the IP address connected to the domain name)

2) The DNS recursive resolver contacts a root nameserver (a master server that maintains a list of all top-level domains (TLDs))

- The root nameserver doesn't have the specific IP address for the requested domain, but it can direct the resolver to the appropriate TLD nameserver

- The DNS recursive resolver, with the information from the root nameserver, contacts the TLD nameserver of the domain entered by the user

- The TLD nameserver contains info about the authoritative nameservers 

3) The TLD nameserver directs the DNS recursive resolver to the authoritative nameserver for that domain

4) The authoritative nameserver returns the IP address for the domain to the DNS recursive resolver, which then sends this IP address to the user

5) The user’s device, now with the correct IP address, contacts the main website server, and the website can load

Process for setting up your own domain in AWS:

1) Log in to AWS 2) Go to the “Route 53” service. 3) Create a Hosted Zone:

Click on “Create Hosted Zone.” Enter your domain name and click “Create.” Make suer to note down the name servers provided by Route 53, which will be used in the next step

4) Update Name Servers:

Find the option to manage DNS or name servers on the website you registered a domain from Replace the existing name servers with the ones provided by Route 53 when you created the hosted zone.

5) Configure DNS Records

In the AWS Route 53 console, go to your hosted zone. Add DNS Records: Click on “Create Record Set.” Add necessary DNS records like A (IPv4 address), CNAME (canonical name), etc.

  • A is a record pointing to the public IP address of your instance.

Creating the NGINX file:

Navigate to /etc/nginx/sites-available directory in your AWS terminal


Create the NGINX config file using the command sudo nano *uniquename*

This is what the file should look like:

server {
   listen 80;
    listen [::]:80;
    server_name -----.duckdns.org; # CHANGE SERVER NAME TO YOUR REGISTERED DOMAIN
    location / {
        proxy_pass http://localhost:8---; # CHANGE PORT TO YOUR UNIQUE PORT
        # Simple requests
        if ($request_method ~* "(GET|POST|PUT|DELETE)") { # Customize Request methods based on your needs
                add_header "Access-Control-Allow-Origin"  *;
        }
        # Preflighted requests
        if ($request_method = OPTIONS ) {
                add_header "Access-Control-Allow-Origin"  *;
                add_header "Access-Control-Allow-Methods" "GET, POST, PUT, DELETE, OPTIONS, HEAD"; # Make sure the request methods above match here
                add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
                return 200;
        }
    }
}

To save changes, ctl X or cmd X, then y, then enter


Create a symbolic link: cd /etc/nginx/sites-enabled, then sudo ln -s /etc/nginx/sites-available/uniquename /etc/nginx/sites-enabled (change uniquename to your nginx config file name)


Validate by running: sudo nginx -t

Restart nginx by running sudo systemctl restart nginx

Test in Browser