#!/usr/bin/env ruby # Amazon Web Services EC2 Query API Ruby library # # Ruby Gem Name:: amazon-ec2 # Author:: Glenn Rempe (mailto:glenn@rempe.us) # Copyright:: Copyright (c) 2007-2008 Glenn Rempe # License:: Distributes under the same terms as Ruby # Home:: http://github.com/grempe/amazon-ec2/tree/master #++ # CREDITS : Credit for this bit of shameful ripoff coolness # goes to Marcel Molina and his AWS::S3 gem. Thanks! # Usage : running this starts up an irb session and # sets up the connection to EC2 as a class variable called # '@ec2'. So just do something like the following on the # shell command line: # macbook-pro:~ glenn$ ec2sh # >> @ec2.describe_images # => [#> @ec2.methods.sort returns : a string representation of ALL images >> @ec2.describe_images.to_s returns : an Array of EC2::Response objects, each an EC2 image and its data >> @ec2.describe_images.imagesSet.item >> @ec2.describe_images.imagesSet.item[0] (an OpenStruct of a single item in that array) >> @ec2.describe_images.imagesSet.item[0].to_s (a String representation of that OpenStruct item) MESSAGE puts welcome_message exec "#{irb_name} -r #{ec2_lib} -r #{setup} --simple-prompt" else puts "You must define AMAZON_ACCESS_KEY_ID and AMAZON_SECRET_ACCESS_KEY as shell environment variables before running #{$0}!" end