AWS S3 is great for hosting highly available and reliable files. Users can use a web browser to access the files as if browsing a website if public access is enabled on your S3 bucket. A public S3 bucket, however, does not allow for the following:

  • Custom domain name
  • Custom error pages
  • Index document for root path
  • 301 redirects

AWS S3 bucket can be used to host highly scalable and available static websites by enabling Static Website Hosting option for the S3 bucket.

Steps to host static website on AWS S3:

  1. Create a public S3 bucket.

  2. Go to S3 section of your AWS Management Console

  3. Go to the public bucket to enable static website hosting by clicking on the bucket name.
  4. Click on the Upload button to open the file upload dialog.

  5. Click Add files to select files to upload.
  6. Select files to upload and and click on the Open button.

    The select dialog allows for multiple file selection.

  7. Click Upload to begin uploading the files.
  8. Configure Static Website Hosting for the bucket.
  9. Click on the Properties tab.

  10. Click on the Static website hosting card.
  11. Select Use this bucket to host a website.
  12. Configure options for static website hosting and click Save.

    • Index document
      • Default page for the website.
    • Error document
      • Page to show when errors such as 404 File not found occurs.
    • Redirection rules
      • Rules for website redirection.

  13. Directly access files you've uploaded using the following format:


  14. Access root document.

    Should display content of Index document

  15. Access nonexistent file to simulate a file not found error.

    Should display content of Error document