Traditionally when planned (or unplanned) data center outages occur the company website is the most visible hit. This leaves the web folks scrambling to find a solution to bring something up for the outside users while the problem is addressed.
However, unless the internal problem is fixed, the only way out is to stand up another server somewhere. Of course this is problematic because of the speed of domain name propagation. Over the years it’s has gotten much faster, clocking in globally in as little as 4 hours for a change. But wouldn’t it be great if we could simply point our domain somewhere else on the fly?
With Amazon’s new Route 53 you can do just that.
Now I don’t represent or work at all for Amazon, and I’m by no means a “cloud expert”, but recently I was tasked with finding a solution to be able to display a webpage with a downtime message while our datacenter has a complete shutdown for a new UPS install (over 4 hours).
The first thing that sprang to mind was “hey, I can put it up on that cloud thingy”. What I found was a myriad of solutions but we just needed something cheap and fast to display a simple one page message.
In my research I found the solution in Amazon Web Services (AWS) and their S3 storage.
AWS S3 provides a means to upload static files with which you can reference by URL. Sounded perfect but then I ran into the age old problem of DNS propagation again. I didn’t want to have to move the domain to point to the S3 storage days before, then try and move it back after. This would, in effect, take our site down for days while DNS propagated worldwide.
At that point I really thought I had run into a brick wall. But then Amazon released Route 53. Route 53 is defined as a “scale-able domain name system”.
For my purposes what this offers is the ability to point a domain name from my registrar to 4 global Amazon nameservers. Once this propagates I then have the ability via the AWS control panel to re-point the domain anywhere within a matter of seconds, not days.
There is only one catch with all this and that’s www urls and non-www urls.
If I register domain.com with Route 53 I gain all the ability to point that domain name via CNAME record to S3 storage (something like www.domain.com.s3-website-us-east-1.amazonaws.com.) but only with the www.domain.com version.
The problem is with the non-www record, as you can only use an A record to an IP for this and you can’t register a CNAME on what they call the “apex domain”. So while www.domain.com works to S3 storage, domain.com will not out of the box.
So what’s left? Well, there’s this little thing called EC2 micro instances. These are micro Linux instances you can bring up on-demand.
To solve the “www problem” I brought up an EC2 micro instance, installed Nginx (you could use Apache), then I added a redirect back www.domain.com for any requests of domain.com in the Nginx config. The final piece to this was to assign an Elastic IP which gave me a static IP for this micro instance.
All I had to do then is plug this IP into my A record for domain.com and I was in business.
Now what I have is a viable and quickly updateable solution for about $2.00.
Thank you Amazon!