The only reason we backup instances or servers is so we can ensure that they are recovered properly when needed. If you are a Windows user, however, the EC2 instance recovery process may require a bit more effort.
Linux vs Windows
AWS offers two back-up methods. You can either create images or you can take snapshots of volumes. We have come to the conclusion that snapshots are more suitable for cloud backup since you can ensure their consistency. With Linux, you can take a snapshot of each volume of an instance, then create new AMIs from those snapshots. As a result, instances can be launched from the newly created AMIs.
With Windows, on the other hand, a problem arises when trying to accomplish this task because of a limitation that was set by AWS. While AWS does enable creating AMIs directly from EC2 instances, there is a specific limitation in Windows that does not allow you to create launchable AMIs from snapshots of your instances. Consequently, if you cannot create AMIs from snapshots of the instances, they cannot be recovered. Therefore, when you take snapshots of a Windows instance, you can recover the volume from that snapshot, but you cannot create an AMI and launch an instance.
This is not the end all and be all for Windows instances, however. Below, I will share 3 ways Windows EC2 instances can be backed up and recovered using AWS. At the end of the day, it is up to you to decide which approach best suits your needs.
3 Approaches to Windows EC2 Instance Recovery
One thing to keep in mind with all of the approaches below is that nothing is perfect. It is always best to test a procedure before incorporating it into your repertoire.
- Recover from an AMI – If you don’t want to bother with snapshots, you can keep back-up and recovery simple by creating an AMI of your entire instance. This can be done as often as you like, be it once a day, once a week, or at any other frequency.The downside to this approach is that you cannot ensure consistency unless you choose to reboot the instance. Due to the fact that the Windows instance needs to reboot in order to create an AMI, attempting to do this on a frequent basis will result in significant amounts of downtime. For the most part, this can be done once a week, generally on the weekends. However, many production systems find this approach unacceptable, especially if done frequently. Conversely, if you decide not to reboot the instance, there is no way of knowing if the AMI creation is consistent or not. The only way to know for sure that the image is consistent is when Windows shuts down in an orderly manner.
- Recover and Attach – Create an AMI of your instance every once in a while (i.e. once a week), including the root device, which is the disk of Windows C: drive. In most cases, an application’s data will be stored on other instance volumes (that are not the root device) and will be backed up separately. In comparison to the data that is stored on these volumes, data located on the C: drive does not change very frequently. However, by using your AMI as a foundation for a launch, you can launch a new instance, and attach the other most recent updated data volumes. This is generally a successful approach if there are not very frequent changes made to the operating system. Even in case Windows performs an update, it will update itself again when a new instance is started. Nevertheless, be sure to test the approach a few times to make sure you have a working server when it finishes. This approach can be performed with our N2WS Backup and Recovery in one click. By providing an AMI to start an instance, and choosing the data you need from the back-up, the instance will be launched including all of the data volumes with a single mouse click.
- Recover the Root Device – After launching an instance from an AMI, you can then stop the instance and switch some or all of the volumes, including the root device. That way, you can ensure that you have a new instance with the most recent copy of the C: drive.
There are two ways you can go about carrying out this approach:
- Start an Official AWS AMI: For example, if you have a Windows 2012 server, you would want to use an official AWS AMI, launch an instance, stop it, and switch all of the volumes. While this works in most cases, sometimes, it looks like it is good to go, but when you start the instance again, it doesn’t work. Therefore, you must be very careful about which AMI is used for this approach.
- Start Your AMI: We have found that the most effective way of doing this is by creating an AMI from the instance. This can be done once a month or once every three months. After the AMI is created, launch an instance from the old AMI, stop it, remove the existing volumes, and insert new volumes that were made by snapshots in the root device. While it may sound complicated, again, this process is automated with our CPM, simply requiring a single click to replace the root device. Of course, it is vital that you test and ensure the reliability of the recovery mechanism.
This is the most powerful approach in terms of the final outcome. However, while it provides the exact server from the most recent back-up, it is a bit more complicated, and again, needs to be tested. On the bright side, our CPM takes a good portion of the complexity out of the process.
Introducing N2WS Backup and Recovery
As mentioned above, N2WS Backup and Recovery (CPM) can be used with the two latter approaches. CPM automatically creates snapshots to support the approaches above, allowing you to automatically recover Windows EC2 instances from an image and restore a non-root device volume from a snapshot. You can simply either use the original AMI or the AWS public ones. Then, CPM will automatically create an instance with the root device from the AMI and other volumes from the snapshots. All with a single mouse click.
As far as the last approach goes, you can manually create an instance, launch it and stop it. Thereafter, CPM will switch the volumes for you, including the root device. Imagine changing tires on a race car, CPM will change out your root device in one click. It is easy to maintain consistency with CPM in Windows, because N2Ws supports Windows’ Volume Shadow Copy Service (VSS). You can read more about this in our previous post. N2WS Backup and Recovery works well with Windows because all Windows applications support VSS, as well. As a result, all of your application back-up procedures will be consistent.
When all is said and done, there is more than one way to achieve successful data recovery in Windows. The trick is finding the method that is right for you. While N2WS Backup and Recovery can help make the process easier, it is important to run tests so precious data is not lost.