Host a static website with amazon S3

There are two types of website: Static and Dynamic website.
Static website contain web pages that are display as it is designed and stored while dynamic website display to users based on the user request as served by the backend web application.

Cost effectively, static website can be delivered to users using Amazon Simple Storage Service(S3).

Lets learn how to do it.

Choose S3 from the list of services in aws management console

Click Create bucket

Give the bucket a name
NB: Bucket name must unique globally

Scroll down and uncheck block all public access and check the warning message that display under it.

This setting is important because your website needs to be accessed publicly.

Scroll down and click create bucket.

After have created your bucket, you need to upload website files that must contain index.html file.

Click on the bucket name and then click on Upload

Click Add files to select website files from your computer and click upload.

Now Lets configure the bucket to be used for static website.

From inside the bucket page, select properties from the top bar and then scroll down to Static web hosting and click Edit.

Choose Enable

Choose Host a static website

Type the name of your website index file in the Index document textbox

Click Save

From the bucket page, choose permission

Scroll down to Bucket policy and click Edit

paste the below JSON policy in the text area

“Version”: “2012-10-17”,
“Id”: “Policy1686994069933”,
“Statement”: [
“Sid”: “Stmt1686994067923”,
“Effect”: “Allow”,
“Principal”: “*”,
“Action”: “s3:GetObject”,
“Resource”: “arn:aws:s3:::aws.geopossibu.com/*”

NB: change the text in bold with your bucket name.

Go back to Host Static Website from properties to get Bucket Website Endpoint which is the url to get to your website from browser.

Thank you

Happy Learning!

For question on this tutorial, you can connect with me on this channels and let’s learn from each other.

Linkedin : https://www.linkedin.com/in/jeleel-kolapo-abidemi-899418a2/

Twitter: https://twitter.com/Jakolapo