Using S3 To Host a Static Site
Create a Bucket
Create a bucket with your FQDN. E.g. www.mydomain.com. You must already own this domain for this tutorial to work.
Configure the Bucket
Configure the bucket you just created, by:
- Clicking the magnifying glass icon by the bucket name.
- Clicking on "Enable website hosting".
- Specifying the index document. We will create it later.
- Specifying the error document. We will create it later.
- Copying the endpoint url, which we will use later.
- Clicking save.
For those not using AWS Route53, go to your domain registrar's DNS configuration service and create a new CNAME record that points to the endpoint you just copied from your bucket in the previous step.
Upload The Site
Now we need to upload our static site to the bucket so that others can view it. You will need at least an
index.html and a
404.html file. Upload these by clicking on the bucket's name in s3 and then clicking the upload button in the top left corner (also shown in screenshot of next step).
Make The Site Public
Finally, we need to make those files publicly available so that anybody on the Internet can view our site. For each file:
- Click the radio button next to the filename in order to select it.
- Click the Permissions text in the pane on the right, in order to expand it.
- Click Add new permissions.
Everyone, and select
- Save your changes.
Your Site is Ready
You may need to wait a while for your DNS configuration from earlier to propagate over the internet, but within a couple hours or minutes, you should be able to see your static site if you type the domain into a browser.
First published: 16th August 2018