Scripting EC2 Restore from Snapshots

December 6, 2013

We recently had a client build a monster Ec2 instance:

 

  • M3.3Xlarge

  • 100TB Usable storage

 

To create the single 100TB volume required attaching over 100 1TB EBS drives and binding them together using ZFS. 1TB is the maximum size of an EBS volume. 

 

We take snapshots for this client every hour using our AWS Managed Services offiering. As you can imagine the number of snapshots that we have has grown quickly to over a thousand. Each EBS volume has it's own hourly snapshot.

 

The question quickly arose: "How are we ever going to restore this beast from the snapshots?" It will take hours to create the volumes from the snapshots, attach those snapshots to the instance, and finally start the the new instance. 

 

Hours is way too much time to restore such a pivotal machine. So anticipating that this will be a recurring request I created a script to automatically restore an instance from its snapshot. 

 

You provide the instance_id and the date\time of the snapshot set to restore (or None to restore from the latest snapshot). The script automatically creates the new instance with the correct instance type, zone, subnet, security groups, and even EBS optimization setting. It then finds the appropriate snapshots, creates the volumes, and attaches them to the instance with the correct device name.

 

I restored the 100TB instance above in under 3 minutes. The machine booted and without any changes immediately started serving clients.

Please reload

Featured Posts

I'm busy working on my blog posts. Watch this space!

Please reload

Recent Posts

September 17, 2013

September 17, 2013

Please reload

Archive
Please reload

Search By Tags

© 2015 Blume Technical Consulting

  • Twitter Clean
  • LinkedIn Clean