Static Site on s3 With Cloudflare

  Hosting   DNS  
 Dec 2015

If you want to set up a simple static site, amazon’s s3 service is a great choice. S3 is simple to use, reliable and very very cheap. Ideal for simple html sites you have made by hand or more complicated sites generated using Middleman or another Static Site generator.

1. Set up your Buckets

Create your site bucket

First off, goto your amazon web console and select s3. Click the “Create Bucket” button. Give your bucket a name. The name matters. It must be the name of your site - ie “”


Now go into the properties of the bucket and enable website hosting. Enter the document index and error documents. ie, 404.html and index.html.

Take a note of the Endpoint. it will probably be something like:

Upload your files to the bucket and test the site using this endpoint. If you are using MiddlemanApp to generator your site, there is a great gem to sync your build files to your bucket.

Redirect the www subdomain.

You will almost certainly want to redirect the www subdomain to your root url. It’s much tidier than serving your site from both and google prefers it. To do this, add a new bucket and name it “

Go into properties and choose “redirect all requests to another host name”. Type in your host name - “”.

2. Set up Your DNS

Now for the tricky part. Jump over to CloudFlare and create a free account.

You will need to create two new CNAME records. One for the Root url and one for the WW url. Each CNAME record points to the end point S3 created for you for the corresponding bucket.

So, in our example:


Go into the DNS management and take a note of your Name Servers. Over at your name registrar, change your name servers to CloudFlare’s.


You are done. Clear your DNS and check out your site.

A note on Email

If you need to host email for your domain,, google and zoho all have good value and pleasant services that will be much more reliable and better quality than if you had hosted your site on a Cpanel host and self hosted the emails.

Web Development

Got a web project you need doing well? We can help with that!

Find out more