A Simple Guide to Host Secure Websites on S3 with Custom Domain

Jie Feng
Little Big Engineering
6 min readSep 22, 2018

--

Photo by Ibrahim Rifath on Unsplash

S3 is a great option to host a static website due to its simplicity and low cost. But if you want to use it for production, you need to connect the site to your custom domain, set up email forwarding, serve over https and other practical needs. This post describes in a concise way how to do all these so it takes no time to make your site live and serve its purpose.

Hosting on S3

The first thing to do is to put your website on S3.

1. Create a bucket

You can use any name but it is recommended to use your domain/subdomain as bucket name.

2. Upload files to the bucket

3. Enable hosting

Go to Properties tab. Click on ‘Hosting static website’. The ‘Endpoint’ on top is the AWS default URL for your website. Select ‘use this bucket to host a website’ option, and put ‘index.html’ in Index Document. For SPA, you might also need to put index.html in the Error Document for routing.

4. Set up Bucket Policy

Your content needs to be publicly readable for people to see the website. Go to Permissions tag and click Bucket Policy. Then add a template like this:

--

--