Created
April 23, 2011 01:01
-
-
Save lusis/938066 to your computer and use it in GitHub Desktop.
Sure to make amazon love you
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
instance_id = "i-XXXXXX" | |
server = AWS.servers.get(instance_id) | |
server.block_device_mapping.each do |bd| | |
begin | |
puts "snapping #{bd["volumeId"]}" | |
snap = AWS.snapshots.new(:volume_id => "#{bd['volumeId']}", :description => "#{instance_id}_#{bd['deviceName'].gsub("/","_")}-snap") | |
snap.save | |
puts "Got it!" | |
rescue | |
puts "snap failed for #{bd["volumeId"]}. Retrying" | |
sleep 5 | |
retry | |
end | |
end | |
puts "fuck yeah, #devops!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lulz