AWS EC2 Snapshots in a Snap

with PowerShell

Posted by Scott Bollinger / @kfalconspb on July 08, 2015 #Virtualization

Snapshots

I needed a process that would give me basic protection in AWS and take snapshots of my EC2 instances as a DR/BR backup process.

The EC2 snapshots are kept in S3 which gives me 99.99% availability, across the other availability zones in the AWS region. Meaning I'd be covered from an AZ failure.

Building on that, I would copy the snapshots to S3 in another AWS region. Which would cover me in a region failure.

Anyone doing this? Doing this plus traditional backups too?

For the first part of the process I could use AWS cli or AWS PowerShell commands. Both are installed on my Windows instances. A few minutes in google, and a had a few to choose from.

I ended up testing and using https://github.com/CaseyLabs/aws-ec2-ebs-automatic-snapshot-powershell by https://www.caseylabs.com

The Readme describes

"How it works: These scripts will:

Start diskshadow on your instance, in order to keep disk consistency.

Determine the instance ID of the EC2 server on which the script runs.

Gather a list of all volume IDs attached to that instance.

Take a snapshot of each attached volume

The script will then delete all associated snapshots taken by the script that are older than 7 days

Stop diskshadow to allow disk writes again."

Scheduled task that runs

powershell.exe -ExecutionPolicy Bypass -file "C:\aws\1-start-ebs-snapshot.ps1"

The number of days to keep the snapshots is configurable. You also have to have run AWS config to get your default region and point the second cmd file to the 2nd AWS location. Or preconfigure the file and copy it to the location in your script.

Next I'll be working on the copy script for S3 from region to region. Shouldn't be too bad, but I don't like having a utilities box and a single point of failure for that process.

Update: 7/9 met with AWS. You can copies the snapshots from region to region but not directly with S3 commands.

Thoughts?

How did you architect DR/BR and backups in AWS?

What about traditional backups? File level backup to S3?

Hit me up on twitter and let me know.

Thanks,

Scott Bollinger / @kfalconspb