How to host your static website on S3

This a low cost, secure and HA solution that you may use to host your static website . For the demo purposes i am using the domain cloudsandbox.xyz

s3-static-hosting

 

 

  • The first step is to create a S3 bucket

 

 

  • The next step is to Enable Static Web Hosting and fill the name of the index document

 

 

  • Next under permissions, we untick the box Block all public access and confirm the change

 

 

 

  • Once done, we move to the next step where we have to edit the S3 Bucket policy. Use the  following code and edit Line 12 to reflect your bucket name

 

 

  • Then you can upload your index file, in our case demo.html

 

 

  • The next step is to create a Hosted Zone in Route53, if you don’t have one already

 

 

  • When the hosting zone has been created, you can add an A Record to point to your S3 bucket (if Cloudfront will be used for HTTPS, there are a few more steps required and we are to cover that in another post)

 

 

  • You can now see that the A record has been created

 

 

All you have to do now, is type the URL in our case http://cloudsandbox.xyz/ and we can see our page (S3 hosting in this case using HTTP)

For an HTTPS connection you need to create a Public Certificate using ACM and configure CloudFront (we are going to cover that later, in another post)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *