I’m hosting tagdef.com in the Amazon Web Services US-EAST Region, which is located in Virginia. Since this region was partly down during a big storm this summer, I decided to move to Oregon before “Sandy” hit the east coast. In addition to avoiding potential downtime, this was something I wanted to test. How hard is it to move the whole site to another region? Without downtime.
The first step was to boot a new Ubuntu server and Mysql RDS server in Oregon. When I got the server-instances up and running in Oregon with an outdated copy of the database, it was time to do the switch. It went something like this:
- Set tagdef.com in “read only” mode in Virginia.
- Dump the database in Virginia to a file.
- Import the file in Oregon.
- Verify that the Oregon location (still) worked as expected.
- Point the DNS entries to Oregon.
It can take some time before changes in dns propagate to all users, so people might hit the Virginia server some time after I switched the DNS-entry to Oreon. But since Tagdef is one of those read-intensive applications where many more people read than update, this would not affect most users.
Logging server traffic with Google Analytics
When the storm had passed, it was time to move back to Virginia. I have purchased reserved instances there, so it makes sense to continue to use that region for a while.
Since I really did not know how long the DNS-propagation took, I started logging the server-instance to Google Analytics using Non-Interaction Events.
By setting up custom segments in Google Analytics, it is easy to see when the switch happened, and that all the traffic was moved within an hour or two.
It’s also interesting to see the response time measured during the Oregon-switch. Since many of the servers that is used to measure uptime is located in Europe, the latency was increased when the servers were moved to the west-coast:
Since I had to set up the web-server from scratch, it cost me about three hours of labor. There are methods of moving a machine-image between regions, but it didn’t work for me.
The cost of the web-server, load balancer (for SSL termination) and database-instance running for two days: 12 dollars.