Created
April 2, 2009 04:20
-
-
Save probablycorey/89019 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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