Skip to content

Instantly share code, notes, and snippets.

View solarce's full-sized avatar

Brandon Burton solarce

View GitHub Profile
@danrigsby
danrigsby / packer-ami-id
Last active December 14, 2023 15:07
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@lusis
lusis / gimme-my-shit-yo.rb
Created April 23, 2011 01:01
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"
@aurels
aurels / gist:843967
Created February 25, 2011 15:45
stream system command output to STDOUT (ruby)
IO.popen('ant run') do |io|
while (line = io.gets) do
puts line
end
end