AWS S3
is great for hosting highly available and reliable files. The files can then be accessed via web browser if public access is enabled on your S3
bucket. A public S3
bucket however does not allow for the followings:
Static website hosting can be enabled on an AWS S3
bucket to provide the above features via these steps:
Create a public
S3
bucket.
Go to S3 section of your AWS Management Console
Go to the public bucket that you want to enable static website hosting by clicking on the bucket name.

Upload static website files to the S3
bucket.
Click on the
Upload
button to open the file upload dialog.

Click
Add files
to select files to upload.

Select files to upload and and click on the
Open
button.
The select dialog allows for multiple file selection.
Click
Upload
to begin uploading the files.

Configure Static Website Hosting
for the bucket.
Click on the
Properties
tab.

Click on the
Static website hosting
card.

Select
Use this bucket to host a website
.
Configure options for static website hosting and click
Save
.
Index document
Error document
Redirection rules
Test if your static website hosting is properly configured.
Directly access files you've uploaded using the following format:
<bucket-name>.s3-website-<AWS-region>.amazonaws.com/filename
Access root document.
Should display content of Index document
Access nonexistent file to simulate a file not found error.
Should display content of Error document
Discuss the article:
Comment anonymously. Login not required.