by noahlh on July 2, 2014
I recently replaced an aging (and brittle…and risky) physical Windows box in our office with an AWS-hosted EC2 instance of Windows Server 2012 R2 and needed a good way to make sure the instance got backed-up nightly.
The original box was a simple Ubuntu server running VirtualBox-hosted Windows 7. We had QuickBooks Enterprise running there, and the 3 folks who worked on accounting stuffs for us would login via Remote Desktop, do their thing, and sign off each night. That box was running Dropbox and, in theory, should have automatically backed-up our QuickBooks file as soon as the file closed each night.
The problem, however, is that A) Dropbox isn’t daemon/service-based, so if the main user account got logged off for some reason, Dropbox would stop running, and B) Dropbox would only sync when the QuickBooks file was “closed”, which means all users had to remember to both close the file and log off each night. In practice, this didn’t happen.
I felt like that box was a ticking time bomb of non-backed-up financial misery and was dreading getting that call: ”So the hard drives are making a weird sound and I can’t login to QuickBooks – what do I do?”
The solution: Move everything to the cloud. I spun up an Amazon EC2 Windows Server instance, attached some storage, setup RDS (a bit of a process which is the scope of another post), and got QuickBooks running on that server.
The next problem: Amazon EC2 is truly “infrastructure”, which means there isn’t just a simple “automated backup” button (like there is with Microsoft Azure and most linux-based VPS hosts). So I had to roll my own.
The best solution I came up with was to run a set of PowerShell scripts to automate the EBS snapshot process nightly. Based on this excellent post:
The issue with those scripts is that they were written for an old version of the AWS SDK (v1.0). So I dug into the Windows PowerShell ISE, fired up the debugger, and got everything working with the latest version.
Lo and behold, an updated set of scripts. Enjoy!