Problem:
Need to create a static website using S3.
Solution Summary:
We will create a static website in S3 using the Static Website feature of S3.
Prerequisites:
This note assumes that you are familiar with AWS console and creating S3 buckets. This note also assumes you are familiar with HTML at least and could create a simple few page website with some navigations.
Solution Steps:
-
Create a simple few page website with some navigations. Should create at least a landing page as index.html and an error page as error.html.
-
Create an S3 bucket. Leave all options as default.
-
Upload the static website files to the S3 bucket.
-
Under bucket properties, go to Static Website Hosting and select the option: Use this bucket to host a website.
-
Specify a landing page (e.g. index.html) and error page (e.g. error.html), and click save.
-
Under Static Website Hosting, you can also get your endpoint for the website. Click on the link and verify (make sure you have read permissions for files). You should see the index.html file.
-
Make index.html private and access the endpoint again. This time you should see the error.html page loaded.
Important Notes (Exam Tips)
-
S3 static websites is a highly available hosting solution that scales automatically for static file websites that use only HTML, Javascript and CSS.
Recent comments