Hosting an HTML File as a Static Website on an AWS S3 Bucket
Below is how I hosted a static website on AWS S3.
First I went to the S3 dashboard and clicked create bucket. Then I titled the bucket “aloha-from-s3” and created it as seen in Image 1. All other configurations I set to default. It is confirmed that my bucket was made in Image 2.
Then I used my text editor to create a small .html file (Image 3), and uploaded it to the bucket (Image 4).
Now when I got to the object in the bucket (Image 5), I click on the hyperlink but access is denied (Image 6).
Therefore I now must sort the properties to make this a public site and actually host it as a static website. This needs to be done in the bucket policies, not the object, so go back to the bucket, go to policies, and I scrolled down to Edit static website hosting (Image 7 & 8)
At the above point I also specified an index.html document. I did not populate for an error document — it is optional.
I then returned to the object URL, and again I received the Access Denied page. This was expected, because I had not yet configured my permissions to allow public access. Therefore I went to my bucket’s permissions and unblocked all public access (Image 9).
Note that before you can unblock all public access you need to manually confirm that you want to do this by typing and entering “confirm.” (Image 10)
Then for the third time I went to the object URL, and again I received the Access Denied page. This was troubleshot on my Mac by clicking CTRL-SHIFT-DELETE, and clearing my cache (Image 11).
If you are still facing issues & still getting the Access Denied prompt, you can then go to the folder and make public to all (Image 12).
I then returned to the Object URL, and my static website was successfully hosted (Image 13).
*Note that multiple times in this demo, I received an Access Denied prompt when trying to view the website. This is on purpose, so that I can illustrate the multiple layers of troubleshooting used to avoid this failure.*