DEV Community

OLUWATOMISIN OWOEYE
OLUWATOMISIN OWOEYE

Posted on

HOSTING A STATIC WEBSITE, USING AWS S3 BUCKET.

Image description

There are two different types of website namely : Static website and Dynamic website.For the purpose of this article the main focus will be on static website, which is a type of website that is made up of fixed files, such as HTML,CSS, JavaScript, files and images.

Introduction

WHY USE AN S3 BUCKET TO HOST A STATIC WEBSITE?

  1. Highly reliable: S3 provides durability and availability for your data.It store multiple copies of your files across different servers and facilities, reducing the risk of data loss.It also offers automatic backups built in redundancy.

  2. Scalable: S3 is highly scalable which means it can handle large amounts of data and traffic without any issues. Either the website has a few visitors or millions.

  3. Cost effective: S3 offers a pay as you go pricing model, which means you only pay for the storage and data transfer you use. It eliminates the need for upfront hardware cost and allows you to scale your storage based on your needs.

Step by step illustration on hosting a static website using S3.

Create an AWS account so has to have access to S3 service and other AWS service at large.
https://portal.aws.amazon.com

Image description

Click "create bucket"

Image description

Use a unique name for bucket, it serves as a globally unique identifier for your bucket. Also select the appropriate region you want the bucket to be hosted.

Image description

Scroll down, click on Access control lists (ACLs) and object writer enabled.

Image description

Deselect "Block all public access"

Image description

All other option should be kept on default and click "create bucket"

Click on the already created bucket and click upload.

Image description

Following, Get your existing files to add the css, javascript files and css and upload in your bucket.

Image description

Image description

Click on properties tab, scroll down to static hosting and select "Enable" to activate static website hosting. Type (index.html).

Image description

In conclusion, Click on objects tab and select all the uploaded website files, then click actions, scroll down and click "Make public using ACL"

Image description

Finally, you have successfully hosted your static website on Amazon S3.To view the result click on properties and scroll down, copy the endpoint and paste on your browser to access your website.

Image description

Image description

As we draw curtains on this discussion, i hope you have learnt how to host a static website using Amazon S3.

Top comments (0)