I've been using the same web presence provider since 1997. They provided me an account on a shared server to host my site and shell access to manage and update it. I could run PHP or whatever CGI I wanted. Over the years they have provided excellent service and rapid technical support. I have been saved many times in my professional career because I happened to have a shell account on a server outside the company firewall.
Even so, I have become dissatisfied with running my site as a WordPress blog on a shared server. On the rare occasions where I wanted to view my website, I found it to be sluggish. Shared servers are affordable, but one can not always count on others to play nicely. I found that I really wanted nothing more for my website than a few static web pages. I had comments turned on for quite a while. I received only one real comment. The rest was spam.
I also used the shared server to host my email for many years. For the last couple of years, I've hosted my email on Google Apps for free. It is a high quality product and you can't argue with the price.
I've been a big fan of Amazon Web Services since their early days. I've used S3 since shortly after it was offered. I have an EC2 instance running Linux that I've been using more frequently than my shell account. There are a couple of reasons for this. First, my hosting provider uses FreeBSD. That was great back when I was also using FreeBSD at work, but now I'm almost exclusively Linux. The second reason is that I never had root on my hosting account. I'm a sysadmin, and sometimes that just doesn't work for me. <grin>
It had been bouncing around in my head for a while, so I finally decided to make the jump to a static website hosted out of Amazon's CloudFront.
I had many reasons for choosing to host my website this way. I'll try to enumerate some of them here.
While it was not my primary motivation, the cost difference between the old and new can not be ignored. I was paying about $40 per month to my presence provider. My first full month on Amazon cost me less than $10.
One thing that always bugged me about using WordPress was administering it from a GUI. Whenever I wanted to post an article, I had to go to the GUI. Many times, I found myself creating the article in Emacs and ten pasting it into WordPress. I would be much happier with a text based solution I could edit with Emacs and automate with Perl and Make.
It's not like I have 175 million visitors or anything, but web performance is both my hobby and profession. WordPress running on a shared server was just killing me.
So, I'm a Perl geek. I don't know how it happened, but one day, Perl became my go-to language for scripts that are too complex for Bourne Shell. I decided to look for a static website generator that was written in Perl. I did this just in case I had to look under the hood to fix something, but I was not planning on writing anything from scratch.
If I hadn't decided to use Perl, I would have probably chosen nanoc. It looks clean, simple, and seems to have a thriving community.
I chose to deliver my content via Amazon's CloudFront. It is an easy to use CDN that can use either a website or an S3 bucket as an origin. This works out well for me. I use S3 almost daily and s3cmd is perfect for syncing a locally built site to S3.
While I was preparing to do the final cut over, I stumbled upon a serious problem in my architecture. For years, I have been advertising my website as http://wimmer.net/ I had an Apache rule to redirect / to /sysadmin where all the content lies. This worked well at my hosting provider. My hosting provider gives me my own public IP address and I set the @ A record for my domain to that record. No problems.
It turns out that you may not create a CNAME record for @. This is not allowed in DNS. The @ record must be of type A.
So, by this time I have all the work done in porting my site to statically generated and it is being served as http://www.wimmer.net on Amazon CloudFront. I wasn't ready to give up just yet.
I could have easily used my hosting provider to redirect all traffic to http://www.wimmer.net. This would have provided the better performance I was looking for and I could continue to use text tools to manage it. It really bothered me that I came up with a solution that cost more than the original, so I continued to look.
Amazon EC2 had potential. I could provision an on demand instance for as little as $15 per month. That was good, but I thought I could do better.
I finally decided on EC2 Spot instances. I created a spot request for the smallest instance type available. I configured it to automatically redirect traffic from http://wimmer.net/ to http://www.wimmer.net/. I then provisioned an Elastic IP address and set my DNS. I set the spot instance price to be the same as an equivalent on demand instance. My theory is that the market will keep the spot price less than or equal to the on demand price. Worst case, I spend $15 per instance, best case, I spend about $3.
Just to be safe, I put one instance on the East Coast and one on the West Coast of the US. My hope is that both won't be down at the same time.
An additional benefit that I have already realized is the ability to change my theme rapidly with StaticVolt/Template Toolkit. After spending so many hours with the theme I pulled from WordPress, I decided to dump it for something that looks more modern and is easy to maintain. I've used Bootstrap from Twitter as my theme and this time it only took me one Saturday to port it.
I'm glad I took the time to make this change. I got to play with some new shiny toys, my site looks better, it costs less to operate, and now I don't cringe at the slow performance when I pull up my own site.
Later, I'll write some more entries where I dig down into the technical details of some of these processes. I'll probably write about the work flow I use to get the static site published as well as my trials and tribulations with converting from wimmer.net to www.wimmer.net.