Jeff Mesnil
Weblog · Dev · Photos · Books

How to Host a Static Website on Amazon AWS

February 11, 2013

A few months ago, I updated my web site to use static content generated by Awestruct instead of a hosted WordPress instance. It is much simpler to maintain and tweak (something I am constantly doing), less expensive to host since it does not need any runtime or database and static content is fast, cacheable, etc.

At the same time, I moved the hosting from OVH to Amazon S3 which provides static web site hosting at a very competitive price.

More recently, I acquired a Retina MacBook Pro and updated my web site to display Retina-ready responsive images. This requires to server several JPEG files of the same image at various sizes. Retina images may be quite big and using a content delivery service improves the latency to serve these images. I decided to use Amazon CloudFront for content delivery of all my media assets.

This post is a quick reference of the different services and settings I have used to achieve this goal.

Web Site Generation

The source code of my web site is hosted at Github and uses Awestruct to generate its content. I write the posts (including this one) using Markdown syntax and Awestruct generates the whole web site for me (including an Atom feed, archive page, sitemap, etc.)


The content is hosted in a S3 bucket named and is deployed to S3 using Awestruct directly:

$ cat _config/site.yml
      type: s3
      bucket: s3://
$ awestruct -P production --deploy
Syncing XXX/ to bucket s3://

I contributed the S3 deployment to Awestruct recently and there is no release with that feature yet. Alternatively, you can use s3cmd.

Static Website Hosting

I use Amazon S3 to host the static content in a bucket (without the www) and enable the Static Website Hosting in its properties.

I prefer to use the domain name to serve my content but I also want to work and redirect to the naked domain name.

To achieve this, I need a second S3 bucket named However, instead of enabling website hosting, its Static Website Hosting property is set to Redirect all requests to another host name (using the value

This 2nd bucket will remain empty (nothing is deployed to it) but is required to redirect content from

Domain Names

Amazon Route 53 is a domain name service that I use to provide the domain names of my web site.

I created a hosted name for with the following record sets:

  • is a A type record that is an ALIAS to the S3 bucket (the dropdown list will propose all the S3 buckets you own)
  • is CNAME type record corresponding to the S3 bucket public domain name (i.e. in my case it is

Using Amazon S3 and Route 53, it is very simple and cost-effective to host a static web site1. Using Awestruct makes it simple and fun to write content for it :)

Amazon provides good documentation for its Web services including a full tutorial to set up a static website using a custom domain.

Content Delivery Service

For ech retina-ready responsive image I want to display, I need to export eight JPEG files from Lightroom.

My media assets (including these images) are deployed in a S3 bucket named using s3cmd and I enabled the Static Website Hosting for it.

To use Amazon CloudFront as my content delivery service for the media assets, I created a Download distribution from the S3 bucket

Content delivered by CloudFront is served from a domain name. Since I want to keep all my content under my own domain name, I use Route 53 again to serve the CloudFront content from

In Route 53's hosted zone for, I added a new record set for which is a CNAME type set to the CloudFront domain name (i.e. Then in Cloudfront distribution, I added as an Alternate Domain Name.

To sum up:

  • is served by the S3 bucket
  • is redirected to the naked URL
  • is using CloudFront to deliver the media assets and is backed by the S3 bucket

All my content is served by URLs under my domain name With this configuration, I will not be depending on any third-party URLs for my own content If I decide one day to move to another hosted service or platform2.

  1. I leave as an exercise to the reader how to setup Awestruct, S3 and Route 53 to provide a staging web site at to check before going live on the "production" URL at :) 
  2. And I certainly will: since I started my weblog in 2004, I moved from Movable Type to Blogger to Wordpress to Jekyll and finally to Awestruct for the software and from jroller to OVH to S3 for the hosting.