DEV Community

Gbemisola Esho for AWS Community Builders

Posted on • Edited on

Do you know you can host your website on AWS and distribute its content across the globe all in minutes.

An online presence is not an optional strategy for an individual,company or corporate organisation in fact, a reliable hosting service provider is of utmost importance.
You can host your static website on AWS and have your content seen global as it distributed.
AWS does this easily, as you load your files into the AWS environment using a resource called Simple Storage Service called "S3" for short a scalable storage service in the cloud.
S3 is a object storage service that has high scalability and availability,hosting your website in S3 assures security,speed and protection against data loss.
S3 hosts the the website and Cloudfront delivers your content to visitors of your site.

The first step is to login to your AWS console and search S3:

Image description

Then you click s3 and create a bucket :

Image description

To create a bucket and give it a unique name:

Image description

Make sure you affirm ownership of the bucket by enabling ACLs:Image description

Then you go on to uncheck "block access" this disables the bucket from being access so you need to uncheck it:
Image description

AWS would what you to affirm that you are aware of the settings and changes you have performed by acknowledging this, then you create a bucket.

Image description

After you have created the bucket you go to properties scroll to enable static website hosting edit and enable:

Image description

Scroll down through the page and search for index document and error document and write index.html and error.html respectively save changes and success.

Inside the bucket, still go on to tabs and click permissions scroll down to bucket policy and edit and apply the bucket policy:

Image description
Edit the policy by replacing resource line were "my bucket" is with your bucket name.
The bucket policy to be applied can be found heresave your changes.

Then you move on the tab that has object,upload your files, not files one by one not the folder starting with the index.html:

Image description
After you have successfully uploaded the files, go on to the property tab an endpoint has been created.Click to copy the link and paste to a browser.
A website is displayed.
The website has been successfully hosted in the bucket,to get website and the content out there globally with speed, you can use another AWS resource called [Cloudfront].(https://aws.amazon.com/cloudfront/url).Cloudfront uses edgelocations to make distributions.
You go the console again and search bar and look for Cloudfront,when you get there you create a distribution.The distribution enables you chose the source data you want to distribute and the location you want to send it too.
Cloudfront does different type of distribution including Web distribution and RTMP.

Image description
A distribution is created and the website delivered on Cloudfront and the website is seen in this link
Image description

The website is now accessed through Cloudfront distribution for all to see.

Architectural diagram of the website hosted and distributed by Cloudfront inspired by @stuart_a_scott

Image description

Top comments (0)