Last week, as part of my effort to move my domains away from godaddy.com, I decided to move this blog. That move is complete and what you are looking at is now hosted on an Amazon EC2 “instance”. What follows is my experience and notes on the costs of doing this.
First off, on a 3 year hosting plan at Godaddy, I was paying about $3.20 per month, which is very very cheap. You cannot get that price directly, but I had some coupons. A more normal cost for Godaddy is about $5.00 per month. My final costs for my new hosting solution on EC2 are:
- First year: $0 per month.
- Next 3 years: $ 6.43 per month, plus bandwidth (mostly free, unless I hit the front page of Reddit).
This is not as good as Godaddy, but it is a very acceptable rate to me (given I have complete root access to the machine and can do anything I want with it).
Below is the analysis of the EC2 costs. For reference, here is a link to the EC2 pricing sheet. My costs are for the us-east Amazon region – costs in other regions are different.
- First year: Amazon gives away one t1.micro instance plus bandwidth to new AWS customers for the first year. This is why the first year is free.
- Next 3 years: $100 for 3 years of “Heavy Utilization Reserved Instance” (t1.micro), plus $0.005 per hour ($43.80 per year), do the math and that comes out to $6.43 per month.
Actually doing the move – the easy way
[UPDATE: I have posted a short YouTube video on how to do this]
The first step was to go into my existing WordPress blog and do a complete export of my posts and pages (Tools/Export/All Content). With this downloaded to my local machine, I felt ready to get going.
WordPress boasts a “famous 5 minute install”, but don’t be misled by that – it can be done, but that depends highly on your Linux skills. The PerfectAPI vision is to make things simpler, so I have for you the following, with all my experience of doing the move baked in. Skip to “the hard way” further down in this post if you like it that way.
- ami–e5e6328c – a us-east Amazon EC2 Ubuntu 11.10 EBS image that is set to go with what you need. Assuming you are already signed up and have some experiencing using ssh with Linux machines on EC2, this should give you something close to the 5 minute install.
To start with the image above, first launch it into a t1.micro instance. Be sure to use a security group that allows port 80 (http) access, and one that allows SSH access (port 22). Once the image is running, ssh into it using a tool like Putty. A reasonable & quick guide to using Putty for this purpose can be found here. Note that the login name for the instance above is “ubuntu“, not “root”.
Once logged in, install WordPress by executing the command:
(This is my custom install script). Installing in this way ensures your instance has its own unique passwords for mysql and wordpress (not the same as everyone else using the above image).
Once the install completes (10 seconds), go the the AWS console and set yourself up an “Elastic IP”. (An elastic IP is just a public IP address that you can point your domain at). Associate your new Elastic IP with your new instance. Then, go to your blog at:
…and complete the WordPress setup. Use Tools/Import/Wordpress to re-import all of your posts and pages. Setup your theme, play with your widgets, install some plugins. Do not change the url of the blog in your General Settings until you are ready to switch over. Failing to heed this advice will make the new blog redirect to the old whenever you login. Very annoying and difficult to change back.
Final step is to switch your domain records – use whatever tools your DNS provider has to point your domain at your elastic IP address. After that, you can set the correct URL in the General Settings of the new blog. It can take a while before DNS changes kick in – if you’re impatient, you can temporarily edit your hosts file to see the changes early.
Put a note on your calendar for 1 year after your Amazon AWS signup date, to purchase yourself a reserved instance, so that the lower pricing kicks in.
Doing the move – the hard way
The first trick for getting any new instance up on Amazon is to find a base AMI image that you like. I like the Ubuntu images at Alestic, so that is where I started. After creating an image with an instance, you have a way to go before you can even get started on WordPress, for example you need to install a LAMP stack (apache, mysql, php), you want to ensure the instance stays up-to-date with linux security patches, etc. Anyway, I created scripts to be able to do all of this in a repeatable way, and they can be found on my amigenerator project on Github.
If you need, here is a direct link to the scripts. The scripts only work when run from the ami-generator tool, so looking at them on Github is mostly for education. The ami-generator tool itself is still in alpha stage, so I am not going to include instructions on how to install/use it here.
My advice – just do it the easy way instead. (But if you do have suggestions on how to improve the scripts, please do let me know).