How I hosted my websites for almost nothing for a year

Photo by Igor Miske on Unsplash

How I hosted my websites for almost nothing for a year

Let’s start, created my webpage using HTML, CSS, and JS. Then I have used GULP to minify CSS and JS.

Created an aws account https://aws.amazon.com/, so got a chance to use the free tier.

In the past, I have hosted websites for different small-scale business, using RapidGator or Godaddy which charges monthly/yearly for the client.

This was an issue with some of them because there was not much impact on there sales/visitors on the website. Still, they are being charged monthly. Some of them even asked for a less costly solution. That how this journey of mine begins.

I was already working with aws cloud on my day job. As a full stack dev, so I started to found a solution inside aws. AWS cloud has a pay as you use structure.

AWS has a service called S3 https://aws.amazon.com/s3/ which provide a way for static website hosting. I have gone through all the DOCS https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html

Now, let me tell you I implemented it.

  1. Created an aws account https://aws.amazon.com/

  2. Created an s3 bucket according to the website name. eg. if the website name is www.textboxcompany.com then create the bucket with the same name. Also, an important point is if you want to host textboxcompany.com then you will need to create another bucket with the name textboxcompany.com.

  3. Now change the policies of the bucket to the public, basically what your doing giving access to bucket content/object to the public.

  4. Upload your HTML, CSS, and JS to the bucket.

5. Enable static website hosting

6. Copy the endpoint URL because we are going to use it at domain registrar to point that domain URL to the bucket, also type your index document you website start starting/index HTML.

7. For Godaddy, I can guide you quite comfortably. Go to godaddy.com, open DNS manage console

8. Create a new cname entry type www and value is endpoint which you have copied in the 6th step. It takes around 30 min or more to reflect these changes.

Feel free to comment, I will be writing the next article to add a CloudFront to the same infrastructure. Already implemented this architecture with CloudFormation its already been around 7months and the cost is almost nothing with respect to GODADDY/Rapidgatorhosting. Also, I have multiple API gateways and lambda for doing some backend-related functionality, still, the cost is very low.