Skip to content

Instantly share code, notes, and snippets.

@lusis
Created April 23, 2011 01:01
Show Gist options
  • Save lusis/938066 to your computer and use it in GitHub Desktop.
Save lusis/938066 to your computer and use it in GitHub Desktop.
Sure to make amazon love you
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!"
@benjaminws
Copy link

lulz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment