Skip to content
Ameer Deen edited this page Jan 9, 2014 · 17 revisions

Please note that this tool works for Windows volumes created from exactly ONE windows physical disk. STRIPED VOLUMES, THEREFORE, WILL NOT WORK HERE. This tool is designed to run ON THE EC2 INSTANCE that requires snapshotting of EBS volumes

Overview

This tool enables two scenarios:

  1. Remembers all EBS attachment configurations: In the event of an instance failure, a new instance will be able to attach to the appropriate volumes using the same EBS volumes, AWS EBS Devices (For /dev/xvdf etc) and online the volumes as drives using the same drive letter as before.

  2. Creates EBS Snapshots of non boot volumes: In the event of failure, it simplifies creating volumes using snapshots and re-attaching the volumes to an instance while preserving the correct drive configurations.


Remembering EBS volume attachment configuration

To record existing EBS drive configuration info, run the following command from your EC2 instance:

.\snapshottercmd -o tagvolumes

The above command will find the EBS volumes attached to the local EC2 instance and tag the volumes with your EBS attachment configuration such as drive letters, AWS Device etc. To re-attach the volumes, type the following command:

.\snapshottercmd -o restorevolumes

To forcibly detach volumes already attached to the required AWS devices, use:

.\snapshottercmd -o restorevolumes -F 1

EBS Snapshots

To create snapshots of EBS volumes attached to the local instance, type:

.\snapshottercmd -o snapshotvolumes

To list snapshots of attached volumes type:

.\snapshottercmd -o listsnapshots

You should see output similar to:

 -----------------------------------------------------------------------------------------------
|TimeStamp                     |BackupName|Device    |Drive     |ServerName     |SnapshotId     |
|-----------------------------------------------------------------------------------------------|
|Tue, 07 Jan 2014 05:24:22 GMT |web       |xvdf      |H         |WIN-3AR123BB211|snap-xxxxxxxx  |
|Tue, 07 Jan 2014 05:24:22 GMT |web       |xvdg      |E         |WIN-3AR123BB211|snap-xxxxxxxx  |
|Tue, 07 Jan 2014 03:00:09 GMT |web       |xvdf      |H         |WIN-3AR123BB211|snap-xxxxxxxx  |
|Tue, 07 Jan 2014 03:00:09 GMT |web       |xvdg      |E         |WIN-3AR123BB211|snap-xxxxxxxx  |
|Mon, 06 Jan 2014 08:25:28 GMT |web       |xvdf      |H         |WIN-3AR123BB211|snap-xxxxxxxx  |
|Mon, 06 Jan 2014 08:25:28 GMT |web       |xvdg      |E         |WIN-3AR123BB211|snap-xxxxxxxx  |

To restore latest snapshot, type:

.\snapshottercmd -o restoresnapshots

To restore a specific snapshot, specify timestamp:

.\snapshottercmd -o restoresnapshots -T "Mon, 06 Jan 2014 08:25:28 GMT"

# For usage syntax, type:

.\snapshottercmd -?

And you should see something similar to:

Usage: SnapshotterCmd options

   OPTION             TYPE         DESCRIPTION                                                                                                                                                                                                                                         
   -Operation(-O)     operation*   One of: 'snapshotvolumes', 'restoresnapshots', 'tagvolumes', 'restorevolumes','listvolumes' or 'listsnapshots'                                                                                                                                      
   -BackupName(-B)    string       A name for your backup. Defaults to this EC2 instance's 'name' tag or hostname if unspecified.This name is an AWS resource tag used to either tag or find your snapshots                                                                            
   -TimeStamp(-T)     string       The GMT Timestamp of the snapshots you want to restore. Specified optionally.For e.g. "Fri, 27 Dec 2013 01:51:53 GMT". Default is to use latest snapshot. You can query for the timestamps of your existing snapshots using the list operation.    
   -ForceDetach(-F)   switch       Force detach already attached volumes during restore. Default is '0' or 'False'. Use '1' or 'True' for testing.                                                                                                                                     
   -WhatIf(-W)        switch       Show what would happen if backup or restore was run. Default is '0' or 'False'. Use '1' or 'True' for testing.