Static site hosting in AWS S3 is on of the fastest easiest and cost effective way to host a static website. So let’s get into it.

First of all you need to have a S3 bucket. To create a bucket simply go to the S3 service in AWS console and click create bucket give it a name, if later on you want to access site hosted in this bucket using a domain name you must keep the bucket name same as domain name, for example if you want to access the S3 hosted site using dev.example.com domain your bucket name should be dev.example.com.

Alright, once you have the bucket next step is to make it public, that I have covered in my another post please follow steps on how to make s3 bucket public. After you make the bucket public, enable static hosting on the bucket.

Go to the S3 bucket properties and click on Disabled under Static website hosting

static website hosting

Select Use this bucket to host a website and mention the index document which is index.html and then Save. Note down the Endpoint that you will use to access the website.

After enabling the static hosting you can upload your code to the bucket and access it using the Endpoint from any browser. That’s it you have successfully hosted a static website on AWS S3.

The website is being accessed from the endpoint provided by AWS if you want to use your custom domain you need have to use Route53 service of AWS you can follow configure custom domain on static s3 website to achieve that.

Also this website hosted in s3 is without any HTTPs support, to configure HTTPs for static s3 site you can checkout my post on how to configure HTTPs for static S3 website.