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?
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.
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.
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
Click "create bucket"
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.
Scroll down, click on Access control lists (ACLs) and object writer enabled.
Deselect "Block all public access"
All other option should be kept on default and click "create bucket"
Click on the already created bucket and click upload.
Following, Get your existing files to add the css, javascript files and css and upload in your bucket.
Click on properties tab, scroll down to static hosting and select "Enable" to activate static website hosting. Type (index.html).
In conclusion, Click on objects tab and select all the uploaded website files, then click actions, scroll down and click "Make public using ACL"
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.
Top comments (0)