Web hosting with AWS Route 53 and S3

If you plan to have your personal website, for blogs or weddings, mostly static HTML with some JavaScript, you may not know that you can use AWS Route 53 + S3 for a simple yet cheaper solution. For comparison, GoDaddy charges at least $3.99 per month for web hosting, while AWS charges around ~$0.50 depends on the traffic volume.

Step 1: Register your custom domain. There are many websites allow you to purchase domains, and you can always use Route 53 -> Domains -> Registered Domains -> Register Domain to buy a domain. In this example, let’s use http://www.superdasheng.com.

Step 2: In S3, create two buckets: “www.superdasheng.com” as well as “superdasheng.com”. Upload one HTML file, say “index.html” to “www.superdasheng.com”, and set this bucket’s property to enable web hosting with index document being “index.html”. Set the bucket property of “superdasheng.com” to redirect all requests to “www.superdasheng.com” bucket. You will see a link generated for your website and clicking on it, you should see index.html loaded.

Step 3: In Route 53, create a hosted zone named “superdasheng.com”, and follow the instructions here to create a name server. Here are a couple of configurations I think are missing from the document. You will need two Type A records:

Name: http://www.superdasheng.com
Type: A – IPv4 address
Alias: Yes
Alias Target: s3-website-us-east-1.amazonaws.com.

and

Name: superdasheng.com
Type: A – IPv4 address
Alias: Yes
Alias Target: s3-website-us-east-1.amazonaws.com.

Step 4 (optional): If you need to set up Mail Exchange (MX) routing record, it is easy to do so as well. Create a new MX record, and I will use Zoho Mail for example (it is a free Email server, you can also host your own Email server on EC2):

Name: superdasheng.com
Type: MX – Mail Exchange
Alias: No
TTL: 300
Value:
10 mx.zoho.com.
20 mx2.zoho.com.
30 mx3.zoho.com.

Now time to test! By entering “www.superdasheng.com”, the website will load and display the content in “index.html”. I have not purchased that domain yet, so you probably will not see anything 🙂

BTW, there is a great tool called “MxToolbox” to help you debug DNS lookup and MX issues.

Advertisements