Over the years of hosting this blog I have changed several hosting providers. I had actually started this on Blogger a long time ago and then I decided to host it myself using WordPress.
I played around with DasBlog as a blogging engine (not too successful I got at that). After moving to WordPress, I shifted a couple of providers before settling on my current provider (BlueHost). I recently renewed my hosting contract with BlueHost. I would have liked to change my provider because the amount of money I had to pay for renewing was a lot more than what I had originally paid. But there was one thing that kept me from moving – the inertia of backing up everything, and then uploading it at the new hosting provider.
The backup itself is not troublesome. What is painstaking is downloading the wp-content folder which contains all the images (or other files) that I have embedded in my posts over the years. And with every passing post, this folder becomes heavier and heavier. So, I decided that I had to rid myself of this artificial dependence that I have developed on my hosting provider. (I do backup my blog database regularly, but the content folder only gets backed up once a month).
The answer in one word for all my problems: Amazon S3.
If you follow the link, you will come to see that Amazon S3 is a storage service offered by Amazon. Why I chose this over any number of other service available for this purpose is something that I probably cannot answer (and you are free to make your own choice as the concept remains the same).
My thought process was this:
- Whenever I need to embed a picture into a blog post, I upload it to Amazon S3 first.
- Then I use the Url from Amazon to embed the image in my post.
- So, now if I have to move my blog I don’t have to worry about the wp-content folder because it would be empty.
I went ahead and signed-up for an account on the Amazon S3 site. The great thing about Amazon S3 is that you have to pay only for bandwidth and storage that you use and since that won’t be a lot in my case, I don’t mind the additional cost right now (which is not too much anyway). Here’s what I will have to pay:
- $0.15 per GB per month for storage.
- $0.1 per GB of Data Transfer In
- $0.17 per GB of Data Transfer Out
- $0.01 per 1,000 PUT, POST, or LIST requests
- $0.01 per 10,000 GET and all other requests
All together, based on traffic trends on my site, my yearly expenditure will come up to $3-$5 (unless I get Dugg or something which will never happen). This is less than what I would have saved if I could have changed my hosting provider.
How did I set it up?
Ok, so I do you set this up? Well, I had to do a number of things actually (and not all the steps may apply to you).
DNS Independence (optional) – One of the optional steps for making this move (that I will describe below) requires making changes to your domain DNS records. Now, to make any changes to these records at my current hosting provider, I would have to raise a support ticket every time. To me, that is kind of lame. I seldom get time to work on these mini projects of mine, and it is not acceptable to have to wait while some support tech is taking forever to make a simple change to my DNS records.
So I decided to take care of my own DNS needs. I created an account at DNSMadeEasy. This is a DNS hosting service which allows me to manage my DNS. I simply pointed my domain registrar to use DNSMadeEasy servers as my Name Servers, and then I setup the DNS records for my domain (gadodia.net) to point to my hosting provider.
This is something that is totally optional for someone who is not comfortable working with DNS records. In this case, you are better off dealing with your hosting support.
Amazon Buckets – the next thing to do after you have setup your Amazon account is to create buckets. Amazon doesn’t provide a folder structure to organize your files. At best you are allowed to create buckets which allow you to segregate your files into different slots. However, beneath a bucket, its a flat structure.
A number of tools are available in the market which allow you to simulate a folder hierarchy under a bucket and the two I use are S3Fox (a FireFox plugin) and S3 Backup (a windows application). Both are excellent tools (I use S3 Backup for bucket management, and S3Fox for everything else).
I went ahead and created a bucket called “images.gadodia.net”. What this does is that makes available the following Url: http://images.gadodia.net.s3.amazonaws.com. Using this Url, I would be able to access any image I upload into that bucket.
By default any file you upload to Amazon has permission denied to everyone. However you can edit those permissions very easily by using S3Fox.
Pretty Urls (optional) – well, now that I have created a bucket, and I can upload images into it, and I can access these images using a Url, I want to make my Url prettier. I want the images to be accessed by simply using http://images.gadodia.net.
To do this, I need to create a CNAME DNS record for my domain. And that’s what I did. I created a CNAME record ‘images.gadodia.net’ which points to ‘images.gadodia.net.s3.amazonaws.com’. This allows me to access my images using a prettier Url (take a look at the Url of the image in this post).
There is another added advantage of this approach. If tomorrow I decide that I want to move away from Amazon as my image hosting service; I can do so easily without the fear of breaking anything in my blog. I can simply reconfigure my DNS to map images.gadodia.net to the new location of my images and ensure that i copy over the same structure of files to the new location. My blog will continue to run.
There are some disadvantages as well:
- Extra Cost
- Having to remember to setup permissions for every file that i load (it becomes second nature after a while).
- Overall, the posting workflow becomes slightly more tedious as additional manual steps have been added to it.
But overall, I am happy because now I have a peace of mind when it comes to my blogs.