A computer engineer poking at your cerebral cortex.

Hosting your blog for under a dollar per month without ads and unlimited traffic



I have had a number of blogs and web sites over the years. I am alawys looking for the next setup that will cut costs while not affecting peformance.<br/

failure 1:

At one point I bought some web space from godaddy to host a wordpress blog. This worked fine until the MySQL database exceeded my paid tier and deleted half my database. This was a huge problem considering I lost allot of my posts.

failure 2:

My next attempt was using Amazon Web Services (AWS) to host my wordpress blog. I was able to host for a year fine with the free tier. The free tier ran out and then my bill exceeded $30 dollars a month. I was also always worried that someday I would get allot of traffic and the micro EC2 server would just come to a crawl because of the lack of resources on it. Also I know many people are not technical enough to even do this step. It includes running updates and managing database backups which even for a System Administrator I didn’t want to do for a small time blog. I started looking for the next solution.

Success:

I knew I had something when I found Amazon S3 storage. Amazon S3 is a static file system within the amazon cloud that is super cheap for hosting. I wrote a small blog post about S3 here. Now that I knew I could host a web site I had to figure out what blog software to use. Then I found jekyll. First though you will need ruby and rails. I wrote a small blog post on installing this software here.

Once you have Ruby, Rails and the gem command you can now install gems. Gems are additional pieces of ruby/rails code that perform specific tasks. Lets install the jekyll gem.

gem install jekyll
jekyll new my-awesome-site
cd my-awesome-site
jekyll serve


Now that you have you blog running I would read more here. Writing blogs is pretty easy by just creating files inside the _posts directory. The structure of the files are year-month-day-blog-name.txt and the file contents will look like this:

---
layout: post
title: Hosting your blog under 5 dollars a month without ads
---

Your blog entry.  This support all html and even code highlighting.

Once you edit your file you want build the static files. Once the files are built you can view your new blog post on your blog here as long as jekyll server is still running.

jekyll build

I got tired of running jekyll build over and over again so now I just do the below command. It will just build the changes to the local web server every 3 seconds then you can just refresh the web browser to see your changes.

watch -n3 jekyll build

Now you have everything running on your local machine lets push your blog to the S3 bucket. This code can be found <href=”https://github.com/laurilehmijoki/jekyll-s3”>here.</a>

gem install s3_website
mv _jekyll_s3.yml s3_website.yml

Now you need to get your S3_id and get your S3_secret in order to push files automatically to S3. Below is a blank example of the s3_website.yml file. Add your settings:

s3_id:
s3_secret:
s3_bucket:

Once you have it setup correctly you can do:

s3_website push

Now you have your blog on S3. S3 can support unlimited traffic for little cost. I also use Route53 to host the domain name but that is outside the scope of this post.