Hosting your website on AWS with Go Daddy Domain
Finding out a way to host a website with the help of AWS
I wanted to host my website since a year or so. Luckily I found the domain available and purchased it immediately but hosting a website is heck of a pain (at least for the first time).
The domain is registered with GoDaddy. We’ll be looking into hosting a static website digvijayupadhyay.com
using AWS.
Prerequisites
- You need to have a registered domain
- You have an AWS account
Step 1: Create S3 buckets
What are the AWS S3 buckets?
For those who are reading about the AWS buckets for the first time, a super short intro:
Amazon S3 is cloud storage for the internet. You can upload any documents and set the permissions for the access of the documents.
Refer to this article if you’d like to know more about the AWS S3 Buckets.
Creating the buckets
After logging in to AWS account, we click on the services
menu and search for s3
under Storage
options.
Now we’ll create two buckets
- digvijayupadhyay.com (host the website content here)
- www.digvijayupadhyay.com (will be used to redirect to the contents of
digvijayupadhyay.com
bucket)
Now let’s upload an html file to the bucket digvijayupadhyay.com
. We have made sure that the file is public. You can refer to this article for setting the permissions.
Step 2: Configure Buckets
We need to make sure both the buckets are public, by default they are not. In order to make them public click on the the s3 bucket we’ll see some tabs, we click on Permissions
and click on the sub tab Access control list
.
Under public access
we see Everyone
click on the radio button and select Read bucket permissions
and save the settings.
Now for the first bucket digvijayupadhyay.com
we need to go to Properties
tab and click on Static website hosting
we see three radio options. Select the option Use this bucket to host a website
enter the index document and error document and click save.
For the other bucket we need to www.digvijayupadhyay.com
we need to enable the redirect request. We again select the bucket go to Properties
tab and click on Static website hosting
you’ll see the same three radio options.
Select Redirect requests
and in the target bucket
add the name of the bucket with the source files and save.
Step 3: Configure a route 53
What is route 53?
Again for those who are new to AWS, in super short, Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service. It will allow us to configure routing of domain name to the hosting AWS S3 buckets (I am simplifying the concept).
You can refer here for more details.
Create a hosted zone
Let’s create a hosted zone named digvijayupadhyay.com
and the type should be default Public Hosted Zones
. Once the zone is created if we click on the zone, we should see two records. The first one is NS (NameServers) and the other one must be SOA(Start of Authority).
The important one is the NS, we’ll use them while configuring the godaddy account.
I’ll not go into the details of what they are since we don’t need to know much about them for hosting a static site. A quick google search can help if you want to know them in details.
Link with S3 Bucket
We need to create following two record sets.
- “A” Record
Name: Leave the name black (by default the name isdigvijayupadhyay.com
)
Type: A-IPv4 address
Alias: Yes
Alias Target: s3-website.eu-west-2.amazonaws.com (set thedigvijayupadhyay.com
bucket link) - “CNAME” Record
Name: Type inwww
Type: CNAME — Canonical Name
Alias: No
Value:digvijayupadhyay.com
Step 4: Config Go Daddy
Let me put on a disclaimer here, any changes you make related to name servers in the following steps will take about 24 hours so be careful of what you do.
We login to go daddy account click on menu of the domain and click on DNS Management
. We see list of config keys for this tutorial don’t worry about what any of them are for now.
- Look at the nameservers, by default we see two nameservers. We click on change it’ll provide two option “default” and “custom”.
- Choose Custom
- Remember the NS record values in the previous step, add all the 4 NS values in the name server and save.
Step 5: Wait
Now we need to wait for all the DNS servers to get updated. You can check if the changes are reflected with this site. You’ll also receive a mail from godaddy once servers are updated.
Once it’s updated, try opening the site http://digvijayupadhyay.com .