Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created April 2, 2009 04:20
Show Gist options
  • Select an option

  • Save probablycorey/89019 to your computer and use it in GitHub Desktop.

Select an option

Save probablycorey/89019 to your computer and use it in GitHub Desktop.
ZONE = "us-east-1b"
# Kill them all
for instance in EC2::Instance.all
instance.terminate if instance.running?
end
instance = EC2::Instance.run("ami-71fd1a18", :availability_zone => ZONE, :key => "ec2-keypair").first
instance.wait!(:running)
address = if EC2::Address.any?
EC2::Address.entries.first
else
EC2::Address.allocate
end
volume = if EC2::Volume.any?
EC2::Volume.entries.first
else
EC2::Volume.create(:availability_zone => ZONE, :size => 10)
end
volume.attach_to(instance, "sdq")
address.associate_with(instance)
puts address
puts instance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment