Statically Host a Website using AWS S3

Posted By:Shivaranjani Ramakrishnan
Posted on:26 Jul 2019
AWS

What is AWS S3?

Amazon Simple Storage Service (Amazon S3) is a global Infrastructure as a Service solution. AWS S3 facilitates highly scalable, secure and low-latency data storage from the cloud. Everyone knows S3 as a storage service and uses S3 Buckets to store objects such as files, images, etc. AWS S3 has various storage classes for storing your object according to its usage.

Apart from this, S3 can be used for Static Web Hosting, Application Hosting and Software Delivery.

The flow of S3 web hosting insisive cloud.
The flow of S3 web hosting.

How to Statically Host a Website using AWS S3?

Follow the steps to statically host your website using AWS S3. 

Step 1: Create an S3 Bucket with website domain name

Create an S3 Bucket with your website domain name as the bucket name in the region where most of your traffic will be generated. Then click on create.

NOTE: If you wish to have a subdomain you will have to follow the same process as below except the bucket name would be the subdomain name.

Create S3 Bucket insisive cloud
static-s3-1 create bucket

Step 2: Upload All The Required Files In  S3 Bucket

Once your bucket has been created, upload all the required files of the website in the S3 Bucket.

Step 3: Select the Permissions

By default, all the contents of our bucket are set to private, hence we should change some policies so it can be suitable for web hosting. For this, go to Bucket, then go to Permissions, under that click on Bucket Policy and paste the below code snippet. 

 
{    
    "Version": "2012-10-17",    
    "Statement": [{
        "Sid": "AllowPublicRead",
        "Effect": "Allow",
        "Principal": "*",
        "Action": "s3:GetObject",
        "Resource":"arn:aws:s3:::insisivecloud.io/*"
    }]
} 

What this policy does is it allows public read access so the images, etc can be rendered.

static-s3-3 AWS s3 bucket policy insisive cloud

Step 4: Enter Index File Name, Error File Name and Save 

Now, switch to the permissions tab and click on ‘Static Web Hosting’, here enter your respective index file name and error file name and then click on save. 

Static Web Hosting insisive cloud
Static Web Hosting Screen

An S3 endpoint will be present, using that endpoint you will now be able to view your website if the configuration is done correctly.

Not Secured Site insisive cloud
Not Secured Site insisive cloud

Here, you can see that the endpoint is not masked and the site is not secure.

Step 5: Create A Hosted Zone With An A Record Pointing

Now that your site is set up, you need to go to Route 53 or any other DNS system and create a Hosted Zone with an A Record pointing to the S3 endpoint.Under A record choose Alias as ‘Yes’, here your bucket endpoint will automatically pop up. Then click Save Record Set.

Record Set insisive cloud
Record Set

Step 6: Request a certificate from ACM

Request a certificate from ACM or any other certificate provider and update the same in Route 53 or any other DNS service provider.

Now, when you use the domain name it will point to your newly hosted website.

Pros

  •  Insignificant cost of operation.
  •  Little or no management required.
  •  Highly scalable, resilient, and reliable website.

Cons

  • None.

Here, at insisive cloud, we use S3 Static Hosting to host our product page and after the initial setup, we have not faced any issues with respect to it.

How much is AWS S3 going to cost?

Amazon S3 costs are storage plus bandwidth. The actual costs depend upon your asset file sizes, and your site’s popularity (the number of visitors making browser requests). There’s no minimum charge and no setup costs. You’re only charged for the actual Amazon S3 storage required to store the site assets. These assets include HTML files, images, etc. Your bandwidth charges depend upon the actual site traffic. More specifically, the number of bytes that are delivered to the website visitor in the HTTP responses. 

AWS S3 Priced
AWS S3 Price List

Final Thoughts

AWS has a plethora of services everyone can take advantage of. But the simplicity of S3’s static web hosting makes it possible for anyone not just the tech-savvy to be able to use it. Added to the fractional cost that comes along with it and the simple setup, it can be used by small businesses to host their landing pages etc.

Read more: How to Use AWS CloudFront for Statically Hosted Website in S3

Getting started with insisive cloud is quick and simple. Create a role insisivecloud has been scheduling instances and saving users up to 60% . We will be glad to serve you, just drop an email- info@insisiv.com or give us a missed call on +91 730 365 6936.

Leave a Reply

Your email address will not be published. Required fields are marked *


Notice: Undefined index: loggedin_user in /var/www/html/wp-content/plugins/freshchat/widget-settings/add_to_page.php on line 97