cityindex/logsearch — pull request #340 by dpb587 (2014-02-15 01:32:49+00:00)
Title: AWS Snapshot Tools

In summary, the two new commands are:

* `aws-ec2-snapshot-create` - requires a snapshot description, environment/service arguments, queries AWS API to find matching volumes, starts snapshots of all those volumes, and copies over the tag information to those snapshots
* `aws-ec2-snapshot-clone` - similar to creation, except it'll create volumes from the matching snapshots. Currently limited to creation in a single AZ.

Therefore, I can run the following during the deploy process after terminating an old stack which fulfills #337:

$ ./aws-ec2-snapshot-create/bin/run -v 'deploy-20140215T012719Z' live logsearch
enumerated volumes
started snapshot from vol-7df8027f/elasticsearch (snap-375ed1d2)
added volume tags to snap-375ed1d2
started snapshot from vol-c03a13ec/redis (snap-3d5ed1d8)
added volume tags to snap-3d5ed1d8
started snapshot from vol-bd311891/elasticsearch (snap-025ed1e7)
added volume tags to snap-025ed1e7

Then, the clone command helps me out during development to create volumes based off that live snapshot and rename things for usage in a development deployment:

$ ./bin/run -v --availability-zone eu-west-1a --clone-envname dev --clone-servicename logsearch-dpb587-test1 'deploy-20140215T012719Z' live logsearch
enumerated snapshots
created volume from snap-3d5ed1d8/redis (vol-ae202582)
added snapshot tags to vol-ae202582
created volume from snap-025ed1e7/elasticsearch (vol-0d202521)
added snapshot tags to vol-0d202521
created volume from snap-375ed1d2/elasticsearch (vol-982025b4)
added snapshot tags to vol-982025b4