Setting Up a GoDaddy Domain Name with Amazon Web Services

One day, I decided I wanted to start a website. So then… now what? The following post describes the steps I took to purchase a domain name and get it set up with Amazon’s web hosting services.

Step 1: Register for a domain name

Go to GoDaddy and purchase a domain name (e.g. mycowsworld.com)

This reserves a name that people will use to access your website. Now, you’ll need a place to store the files for your website.

Step 2: Sign up for Amazon Web Services (AWS)

Go to Amazon Web Services and sign up for an account.

Amazon has some nice services for cloud computing. One of these services can be used for website hosting (Amazon S3). AWS costs are scaled based on usage (i.e. how much data you store on their servers). My current costs are about 50 cents/month to host this blog.

Step 3: Setup Amazon S3 (Simple Storage Service)

Amazon S3 is an online data storage service, which is part of the AWS suite of tools. In S3, you create “buckets” that will be used to store data. Each bucket can be configured individually, such as changing who has permissions to access a particular bucket.

In this case, we’ll create two buckets: one for “mywebsite.com” and the other for “www.mywebsite.com”. We’ll configure it so that the content will be stored in mywebsite.com and that requests for www.mywebsite.com will be redirected to mywebsite.com.

  1. Click My Account / Console on the top-right of the window and select AWS Management Console
  2. Click Services at the top-left of the window and select S3
  3. Create two buckets: mywebsite.com and www.mywebsite.com. Follow these instructions to create a bucket (http://docs.aws.amazon.com/AmazonS3/latest/UG/CreatingaBucket.html).

Upload files to the mywebsite.com bucket

  1. Click the mywebsite.com bucket
  2. Click Upload at the top-left of the screen
  3. Click Add Files on the pop-up that appears and select the various website files. Multiple files can be selected. (If you do not have website files, you can create a test file with the following code)
    <!DOCTYPE HTML>
    <html>
    <body>
    	Hello World
    </body>
    </html>
  4. Click Start Upload to upload the files to the bucket

Configure bucket permissions to make it accessible to public

  1. Click Properties at the top-right of the screen
  2. Click Permissions
  3. Click Edit Bucket Policy
  4. Add the following to the text box (note: make sure you replace www.mywebsite.com with your own domain name)
    {
    	"Version":"2008-10-17",
    	"Statement":[{
    		"Sid":"AddPerm",
    		"Effect":"Allow",
    		"Principal": {"AWS": "*"},
    		"Action":["s3:GetObject"],
    		"Resource":["arn:aws:s3:::mywebsite.com/*"]
    	}]
    }
  5. Click Save on the pop-up window
  6. Click Save in the *Permissions* pane

Configure bucket for website hosting

  1. In the Properties pane, select Static Website Hosting
  2. Select Enable website hosting
  3. For Index Document, enter in the filename that will be used as the home page for your website. Typically this is index.html (make sure this file is uploaded to the bucket!)
  4. Click Save in the Static Website Hosting pane
  5. To test, click the Endpoint URL shown in the Static Website Hosting pane and see if your website loads.

Redirect www.mywebsite.com requests to mywebsite.com

  1. Click All Buckets on the top left of the page
  2. Click the www.mywebsite.com bucket
  3. Click Properties on the top-right
  4. Click Static Website Hosting
  5. Select Redirect all requests to another host name
  6. Type mywebsite.com in the Redirect all requests to field
  7. Click Save
  8. To test, click the Endpoint URL shown in the Static Website Hosting pane and see if your website loads.

Step 4: Setup Amazon Route 53

Amazon Route 53 will be used to link the domain name you purchased to the buckets you just created.

  1. Click Services at the top-left of the window and select Route 53
  2. Click Create Hosted Zone near the top of the screen
  3. On the right side of the screen, enter your domain name (e.g. mywebsite.com)
  4. Click Create Hosted Zone at the bottom of the panel (After you create a hosted zone, it should appear in the main panel with a check mark)
  5. Click Go to Record Sets near the top of the screen

Create the “A” Record

The “A” Record will point mywebsite.com to the S3 bucket

  1. Click Create Record Set
  2. Change Type to A - IPv4 address
  3. Change Alias to Yes
  4. Click the Alias Target field and select mywebsite.com (s3-website-*)
  5. Click Create Record Set

Create the “CNAME” Record

The “CNAME” Record will redirect www.mywebsite.com requests to mywebsite.com

  1. Click Create Record Set
  2. In the Name field, add www. before mywebsite.com
  3. Change Type to CNAME
  4. Change Alias to No
  5. In Value, enter in mywebsite.com
  6. Click Create Record Set

Step 5: Configure the DNS provider (GoDaddy) to use Amazon Route 53 Name Servers

As the DNS provider, you will need to tell GoDaddy to update the Domain Name Servers to point to the Amazon Name Servers.

  1. In the Record Sets page, note the 4 addresses in the “NS” entry (e.g. ns-123.awsdns-55.net)
  2. Log in to GoDaddy.com
  3. Click My Account at the top of the screen
  4. In the DOMAINS pane, click Launch
  5. Click on the Domain Name that you want to edit
  6. In the Nameservers section, select Set Nameservers
  7. Select I have specific nameservers for my domains
  8. Set the nameservers to the ones noted in the “NS” entry in Step 5.1 (you can omit the ending period)

Tip from Kelton Manzanares: Make sure you delete the default CNAME record in Godaddy for www for your www. domain to work.

Step 6: Test your website

Try entering your domain name into your web browser. Both mywebsite.com and www.mywebsite.com should work! Note that it may take some time (up to several hours) before these settings are propagated to the various servers on the internet.

What is happening?

The following image helps describe the process when a user enters an address into the web browser.

  • There are 13 Root Name Servers spread across the world. These servers parse the request for the top level domain (e.g. .com, .net, etc) and pass to the appropriate server
  • Authoritative Name Servers are defined in the Domain Name manager (e.g. GoDaddy.com). We defined the Name Servers to point to the ones provided by Amazon Route 53
  • In Amazon Route 53, we defined the A record to return the IP address of one of the S3 buckets that was created
  • DNS records have a “TTL” (time-to-live) setting which tells the ISP Name server how long it can hold a record before needing to get a new copy in case of changes.

References

Configuring AWS and GoDaddy settings

DNS – How does it work?