grempe-amazon-ec2 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/History.txt +230 -0
  2. data/License.txt +66 -0
  3. data/Manifest.txt +46 -0
  4. data/README.txt +154 -0
  5. data/Rakefile +4 -0
  6. data/bin/ec2-gem-example.rb +61 -0
  7. data/bin/ec2sh +73 -0
  8. data/bin/setup.rb +19 -0
  9. data/config/hoe.rb +76 -0
  10. data/config/requirements.rb +17 -0
  11. data/lib/EC2.rb +254 -0
  12. data/lib/EC2/console.rb +44 -0
  13. data/lib/EC2/elastic_ips.rb +153 -0
  14. data/lib/EC2/exceptions.rb +136 -0
  15. data/lib/EC2/image_attributes.rb +166 -0
  16. data/lib/EC2/images.rb +134 -0
  17. data/lib/EC2/instances.rb +206 -0
  18. data/lib/EC2/keypairs.rb +94 -0
  19. data/lib/EC2/products.rb +43 -0
  20. data/lib/EC2/responses.rb +175 -0
  21. data/lib/EC2/security_groups.rb +232 -0
  22. data/lib/EC2/version.rb +18 -0
  23. data/script/destroy +14 -0
  24. data/script/generate +14 -0
  25. data/script/txt2html +74 -0
  26. data/setup.rb +1585 -0
  27. data/tasks/deployment.rake +27 -0
  28. data/tasks/environment.rake +7 -0
  29. data/tasks/website.rake +17 -0
  30. data/test/test_EC2.rb +52 -0
  31. data/test/test_EC2_console.rb +54 -0
  32. data/test/test_EC2_elastic_ips.rb +144 -0
  33. data/test/test_EC2_image_attributes.rb +238 -0
  34. data/test/test_EC2_images.rb +197 -0
  35. data/test/test_EC2_instances.rb +325 -0
  36. data/test/test_EC2_keypairs.rb +123 -0
  37. data/test/test_EC2_products.rb +48 -0
  38. data/test/test_EC2_responses.rb +102 -0
  39. data/test/test_EC2_security_groups.rb +205 -0
  40. data/test/test_EC2_version.rb +44 -0
  41. data/test/test_helper.rb +20 -0
  42. data/website/index.txt +427 -0
  43. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  44. data/website/stylesheets/screen.css +138 -0
  45. data/website/template.rhtml +55 -0
  46. metadata +174 -0
data/History.txt ADDED
@@ -0,0 +1,230 @@
1
+ === 0.2.10 2008-04-13
2
+ * Fix bug where ec2#disassociate_address would return 'undefined method 'reject!' for "xxx.xxx.xxx.xxx":String'.
3
+ Thanks to Brian Thomas for reporting.
4
+
5
+ === 0.2.9 2008-03-31
6
+ * Added initial support for API version 2008-02-01. Support for new 'Elastic IP' functionality added.
7
+
8
+ === 0.2.8 2008-02-25
9
+ * Change HTTP API requests to use POST instead of GET. Based on patch #18380 from 'anonymous'.
10
+
11
+ === 0.2.7 2008-02-17
12
+ * Add support for HTTP Proxy when :proxy_server argument is passed. Based on patch from Mathias Dalheimer.
13
+
14
+ === 0.2.6 2007-10-16
15
+ * Updated to support EC2 API version 2007-08-29 released on 2007-10-16
16
+ * Supports new instances type feature. Specify an instance type to launch
17
+ (m1.small, m1.large, m1.xlarge) when you call the 'run_instances' method.
18
+
19
+ e.g. add to the params hash ':instance_type => "m1.small"'
20
+ * RunInstances and DescribeInstances now return the time when the Amazon EC2 instance was launched.
21
+ * Code Tidyup : Removed trailing spaces in code docs.
22
+
23
+ === 0.2.5 2007-09-26
24
+ * Updated using Dr. Nic's newgem v. 0.13.5
25
+ * Updated email address.
26
+ * No functional changes in the gem.
27
+
28
+ === 0.2.4 2007-07-09
29
+ * Changed how require statement for xmlsimple is called so we don't get warnings when running in rails.
30
+ Now it looks like: require 'xmlsimple' unless defined? XmlSimple
31
+
32
+ === 0.2.3 2007-07-06
33
+ * Updated gem to work with new official release of AWS API version 2007-03-01 which occurred
34
+ on July 6, 2007.
35
+ * Added support for primary new feature which supports Paid AMI's and the product codes
36
+ associated with them. Modified several methods to support this change, updated the test
37
+ cases, and added a new method EC2#confirm_product_instance.
38
+
39
+ === 0.2.2 2007-07-03
40
+ * Minor change to test case.
41
+
42
+ === 0.2.1 2007-07-03
43
+ * Some minor changes to the RDocs and README.txt
44
+
45
+ === 0.2.0 2007-07-03
46
+
47
+ * MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
48
+ the way in which you make calls, handle responses, and rescue exceptions from this library.
49
+ If you prefer not to make these changes you can feel free to continue to use the older version
50
+ of the gem. These older versions however will no longer be maintained.
51
+
52
+ * MAJOR refactoring of how methods calls are made. Now all methods are called with a simple hash
53
+ of arguments and none of them are positional. This feels much more "Ruby'ish".
54
+
55
+ * MAJOR refactoring of how responses are returned to users. No longer do you have to call the
56
+ .parse method, and no longer are you getting back simple arrays of information. Responses
57
+ now come in the form of OpenStruct objects that contain all of the data for an object in
58
+ Enumerable form so you can use iterators (.each, .each_pair, etc). All methods return an EC2::Response object
59
+ which inherits from OpenStruct. The return data from EC2, which is in XML form, is parsed
60
+ with XmlSimple and is used to directly construct the return data structure. This allows us
61
+ to know with some confidence that the data structure returned from AWS will always be consistent
62
+ with this library's responses. There is also an .xml attribute for each response object that lets you
63
+ see the full and complete XML response from AWS if that is useful to you.
64
+
65
+ * Added an exception framework which will now throw appropriate Ruby exceptions
66
+ that match those handed to us by Amazon EC2. ArgumentError exceptions will also
67
+ be thrown if you are making calls we know to be illegal or malformed. You should rescue
68
+ these exceptions in your application instead of parsing text responses. All exceptions
69
+ descend from EC2::Error. You can see them all in exceptions.rb in the gem install.
70
+
71
+ * Added a full suite of test/spec unit tests which currently cover 100% of the public methods
72
+ in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
73
+ the reliability of the library as well as our confidence in the code.
74
+ We used to have 0% test coverage. :-/
75
+
76
+ * Added an EC2 command shell : 'ec2sh' which can be called from anywhere and gives you
77
+ an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
78
+ to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
79
+ or @ec2.describe_images to test it out. You must first setup two shell environment variables
80
+ which contain your ACCESS_KEY_ID and SECRET_ACCESS_KEY for this to work. Otherwise an error
81
+ will be thrown when you try to start it. This is way cool and shamelessly borrowed from
82
+ Marcel Molina's fine AWS::S3 library.
83
+
84
+ * Updated API version in the query API request to 2007-01-19, and added all known method calls
85
+ in this version of the API to the gem (including reboot, viewing console output, NAT addressing
86
+ and more!)
87
+
88
+ * Removed .parse method as it is no longer needed or wanted.
89
+
90
+ * Removed 'verbose' attribute writer and a couple of related debug 'puts' calls in EC2.rb.
91
+
92
+ * Removed deprecated alias's used in the library that were added in v0.0.3
93
+
94
+ * Gem now requires XmlSimple gem to be installed.
95
+
96
+
97
+ === 0.1.0 2007-05-30
98
+
99
+ * Repackaged with updated newgem generator v. 0.10.3 from http://newgem.rubyforge.org/ to take advantage of new deployment goodness.
100
+
101
+
102
+ === 0.0.7 2007-03-15
103
+
104
+ * Applied patch from Kevin Clark which does the following:
105
+ * New method to the instances.rb to allow for issuing a reboot command to an EC2 instance.
106
+ * New Mocha based tests (Mocha test suite must be installed to run tests. 'sudo gem install mocha')
107
+ * Cleanup of the test directory.
108
+ * Applied patch from Randy Bias related to CGI escaping error. From his notes:
109
+
110
+ I finally figured out what was going on. It was a compound problem. The first being that you can't
111
+ CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
112
+ encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
113
+ and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
114
+ these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
115
+ like Amazon's side is doing the right thing and is signing the padding. So, the signatures mis-match.
116
+
117
+ I've got the complete patch here and it's about as elegant/clean as I could make it in a short
118
+ period of time. It's a little tough to strip those equal signs when there are so many in the URI.
119
+ I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
120
+ out all '&' and '?' and only the first '='. Then stitching it back together.
121
+
122
+
123
+ === 0.0.6 2007-03-02
124
+ * Patched instances.rb with a bugfix and patch provided by Randy Bias (Thanks Randy!).
125
+ Only minimally tested so please let me know if this causes any problems for anyone.
126
+
127
+ From his notes:
128
+ I wanted to let you know that there appears to be a bug in how user data is passed. In
129
+ instances.rb the line that creates the base64 encoded package of user data is as follows:
130
+
131
+ userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
132
+
133
+ This may have worked prior, but at least right now the CGI::escape appears to cause a
134
+ breakage. More specifically it turns something like this (the actual base64 encoded string):
135
+
136
+ YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
137
+ eHh4eHh4eHh4eHh4eHh4eHh4eHgg
138
+
139
+ Into this:
140
+
141
+ YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
142
+ 0AeHh4eHh4eHh4eHh4eHh4eHh4eHgg
143
+
144
+ And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
145
+ Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
146
+ EOL at every 47 chars, no matter what:
147
+
148
+ ---
149
+ [randyb@master randyb] cat /tmp/foo.rb
150
+ #!/usr/bin/env ruby
151
+ #
152
+ require 'rubygems'
153
+ require_gem 'amazon-ec2'
154
+ require 'getoptlong'
155
+ puts Base64.encode64
156
+ ("012345678901234567890123456789012345678901234567890123456789")
157
+
158
+ [randyb@master randyb] /tmp/foo.rb
159
+ MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
160
+ NTY3ODkwMTIzNDU2Nzg5
161
+ ---
162
+
163
+ The best way to handle this is to strip the CRLFs/EOLs before passing to CGI.escape.
164
+
165
+
166
+ === 0.0.5 2006-12-21
167
+
168
+ * Changes to home page documentation and example files to indicate that you
169
+ should use 'require_gem' instead of a simple require. Not sure if this
170
+ is a result of something I am doing in the packaging of the gem that is
171
+ incorrect or if this is right and proper. I will investigate further.
172
+ * Patched instances.rb run_instances method to allow for submission of
173
+ user data with the command to start an instance. Patch submitted
174
+ anonymously on RubyForge. This had not been functionally implemented
175
+ in the Amazon Web Services sample library prior to this patch.
176
+ * Added simple framework for adding unit tests for the library under test dir.
177
+ No functional unit tests exist yet.
178
+
179
+
180
+ === 0.0.4 2006-12-21
181
+
182
+ * Applied patch from Kevin Clark to svn version 7. Thanks for the
183
+ patch and the description Kevin! Please report if you
184
+ encounter any issues with this patched version. Here is Kevin's
185
+ description which I requested : "It helps me to think of modules as boxes full of classes and
186
+ methods. REXML is a module which holds various classes related to parsing XML
187
+ including REXML::Node, REXML::Document and REXML::XPath. When you
188
+ include a module it takes everything out of the box and places it in
189
+ the local context. So, when you include REXML in the global namespace
190
+ on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
191
+ global object space. This means that I can't have a class called Node
192
+ in my own project (which I do). The library would be a much better
193
+ neighbor if it instead accessed the REXML::Document and REXML::XPath
194
+ classes explicitly through the module."
195
+
196
+
197
+ === 0.0.3 2006-12-16
198
+
199
+ * API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
200
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
201
+ * API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
202
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'revoke' for backwards compatibility.
203
+ * API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
204
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'delete_securitygroup' for backwards compatibility.
205
+ * API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
206
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'describe_securitygroups' for backwards compatibility.
207
+ * API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
208
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'create_securitygroup' for backwards compatibility.
209
+ * Added many API rdoc's, some method descriptions copied from Amazon Query API Developer Guide.
210
+ * Extracted some parts of the formerly monolithic EC2 library out into separate files for manageability.
211
+ * Changed the HTTP 'User-Agent' string used for each request so that we have our own user agent
212
+ to identify this library's calls. Now set the version # in the user agent string based on the
213
+ master version number for this library which is stored in lib/EC2/version.rb and should only
214
+ be defined in one place.
215
+ * Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
216
+ "warning: peer certificate won't be verified in this SSL session". File EC2.rb:96
217
+ * Make 'pathlist' utility method a private method (EC2.rb:111). No reason I can see for this to be exposed.
218
+
219
+
220
+ === 0.0.2 2006-12-14
221
+
222
+ * Bugfix in run_instances method. Method works now. Patch submitted by Stephen Caudill on AWS forums. Thanks!
223
+
224
+
225
+ === 0.0.1 2006-12-13
226
+
227
+ * Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
228
+ Amazon Web Services as example code. No changes or enhancements to that code were made other than
229
+ packaging it as a Ruby Gem.
230
+ * RubyForge project created. http://amazon-ec2.rubyforge.org
data/License.txt ADDED
@@ -0,0 +1,66 @@
1
+ Copyright (c) 2007-2008 Glenn Rempe
2
+
3
+ This software is distributed under the Ruby License. A copy of which is
4
+ provided below.
5
+
6
+ RUBY LICENSE
7
+
8
+ http://www.ruby-lang.org/en/LICENSE.txt
9
+
10
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.co.jp>.
11
+ You can redistribute it and/or modify it under either the terms of the GPL
12
+ (see COPYING.txt file), or the conditions below:
13
+
14
+ 1. You may make and give away verbatim copies of the source form of the
15
+ software without restriction, provided that you duplicate all of the
16
+ original copyright notices and associated disclaimers.
17
+
18
+ 2. You may modify your copy of the software in any way, provided that
19
+ you do at least ONE of the following:
20
+
21
+ a) place your modifications in the Public Domain or otherwise
22
+ make them Freely Available, such as by posting said
23
+ modifications to Usenet or an equivalent medium, or by allowing
24
+ the author to include your modifications in the software.
25
+
26
+ b) use the modified software only within your corporation or
27
+ organization.
28
+
29
+ c) rename any non-standard executables so the names do not conflict
30
+ with standard executables, which must also be provided.
31
+
32
+ d) make other distribution arrangements with the author.
33
+
34
+ 3. You may distribute the software in object code or executable
35
+ form, provided that you do at least ONE of the following:
36
+
37
+ a) distribute the executables and library files of the software,
38
+ together with instructions (in the manual page or equivalent)
39
+ on where to get the original distribution.
40
+
41
+ b) accompany the distribution with the machine-readable source of
42
+ the software.
43
+
44
+ c) give non-standard executables non-standard names, with
45
+ instructions on where to get the original software distribution.
46
+
47
+ d) make other distribution arrangements with the author.
48
+
49
+ 4. You may modify and include the part of the software into any other
50
+ software (possibly commercial). But some files in the distribution
51
+ are not written by the author, so that they are not under this terms.
52
+
53
+ They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
54
+ files under the ./missing directory. See each file for the copying
55
+ condition.
56
+
57
+ 5. The scripts and library files supplied as input to or produced as
58
+ output from the software do not automatically fall under the
59
+ copyright of the software, but belong to whomever generated them,
60
+ and may be sold commercially, and may be aggregated with this
61
+ software.
62
+
63
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
64
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
65
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
66
+ PURPOSE.
data/Manifest.txt ADDED
@@ -0,0 +1,46 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/ec2-gem-example.rb
7
+ bin/ec2sh
8
+ bin/setup.rb
9
+ config/hoe.rb
10
+ config/requirements.rb
11
+ lib/EC2.rb
12
+ lib/EC2/console.rb
13
+ lib/EC2/elastic_ips.rb
14
+ lib/EC2/exceptions.rb
15
+ lib/EC2/image_attributes.rb
16
+ lib/EC2/images.rb
17
+ lib/EC2/instances.rb
18
+ lib/EC2/keypairs.rb
19
+ lib/EC2/products.rb
20
+ lib/EC2/responses.rb
21
+ lib/EC2/security_groups.rb
22
+ lib/EC2/version.rb
23
+ script/destroy
24
+ script/generate
25
+ script/txt2html
26
+ setup.rb
27
+ tasks/deployment.rake
28
+ tasks/environment.rake
29
+ tasks/website.rake
30
+ test/test_EC2.rb
31
+ test/test_EC2_console.rb
32
+ test/test_EC2_elastic_ips.rb
33
+ test/test_EC2_image_attributes.rb
34
+ test/test_EC2_images.rb
35
+ test/test_EC2_instances.rb
36
+ test/test_EC2_keypairs.rb
37
+ test/test_EC2_products.rb
38
+ test/test_EC2_responses.rb
39
+ test/test_EC2_security_groups.rb
40
+ test/test_EC2_version.rb
41
+ test/test_helper.rb
42
+ website/index.html
43
+ website/index.txt
44
+ website/javascripts/rounded_corners_lite.inc.js
45
+ website/stylesheets/screen.css
46
+ website/template.rhtml
data/README.txt ADDED
@@ -0,0 +1,154 @@
1
+ = Amazon Web Services Elastic Compute Cloud (EC2) Ruby Gem
2
+
3
+ == About amazon-ec2
4
+
5
+ Amazon Web Services offers a compute power on demand capability known as the Elastic Compute Cloud (EC2). Using the current API's the compute resources in the cloud can be provisioned on demand by making SOAP or HTTP Query API calls to EC2.
6
+
7
+ This 'amazon-ec2' Ruby Gem is an interface library that can be used to interact with the Amazon EC2 system using the Query API (No SOAP please...).
8
+
9
+ For the most complete and up-to date README information please visit the project homepage at: http://amazon-ec2.rubyforge.org or the EC2 website at http://aws.amazon.com/ec2
10
+
11
+
12
+ == Installation
13
+
14
+ This gem follows the standard conventions for installation on any system with Ruby and RubyGems installed. If you have worked with gems before this will look very familiar.
15
+
16
+ === Installation pre-requisites
17
+
18
+ Before you can make use of this gem you will need an Amazon Web Services developer account which you can sign up for at https://aws-portal.amazon.com/gp/aws/developer/registration/index.html. This account must also be specifically enabled for Amazon EC2 usage. AWS will provide you with an 'AWS Access Key ID' and a 'Secret Access Key' which will allow you to authenticate any API calls you make and ensure correct billing to you for usage of the service. Take note of these (and keep them secret!).
19
+
20
+ === Installing the gem (Mac OS X / Linux)
21
+
22
+ sudo gem install amazon-ec2
23
+
24
+ === Installing the gem (Windows)
25
+
26
+ gem install amazon-ec2
27
+
28
+
29
+ == Usage Examples
30
+
31
+ The library exposes one main interface class EC2::Base. It is through an instance of this class that you will perform all the operations for using the EC2 service including query string header signing.
32
+
33
+ The public methods on EC2::Base closely mirror the EC2 Query API, and as such the Query API Reference in the EC2 Developer Guide ( http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=84 ) will prove helpful.
34
+
35
+ === Ruby script usage example:
36
+
37
+ Try out the following bit of code. This should walk through each image returned by a call to #describe_images and print out its key data. Note in the example below that you cannot walk through the results of the #describe_images call with the '.each' iterator (You'll get errors if you try). You need to instead walk through the Array of items which are in the 'imagesSet' embedded in the response. This reflects exactly the XML hierarchy of data returned from EC2 which we parse to Ruby OpenStruct objects (EC2::Response).
38
+
39
+ #!/usr/bin/env ruby
40
+
41
+ require 'rubygems'
42
+ require 'ec2'
43
+
44
+ ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--'
45
+ SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--'
46
+
47
+ ec2 = EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
48
+
49
+ puts "----- listing images owned by 'amazon' -----"
50
+ ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
51
+ # OpenStruct objects have members!
52
+ image.members.each do |member|
53
+ puts "#{member} => #{image[member]}"
54
+ end
55
+ end
56
+
57
+ === Ruby on Rails usage example:
58
+
59
+ <b>config/environment.rb</b>
60
+
61
+ # Require the amazon-ec2 gem and make its methods available in your Rails app
62
+ # Put this at the bottom of your environment.rb
63
+ require 'EC2'
64
+
65
+ <b>app/controllers/my_controller.rb</b>
66
+
67
+ [some controller code ...]
68
+
69
+ ec2 = EC2::Base.new(:access_key_id => "YOUR_AWS_ACCESS_KEY_ID", :secret_access_key => "YOUR_AWS_SECRET_ACCESS_KEY")
70
+
71
+ # get ALL public images
72
+ @ec2_images = ec2.describe_images().imagesSet.item
73
+
74
+ # Get info on all public EC2 images created by the Amazon EC2 team.
75
+ @ec2_images_amazon = ec2.describe_images(:owner_id => "amazon").imagesSet.item
76
+
77
+ [some more controller code ...]
78
+
79
+
80
+ <b>app/views/my/index.rhtml</b>
81
+
82
+ <h1>EC2 Test#index</h1>
83
+
84
+ <h1>Sample 1 - debug() view</h1>
85
+
86
+ <%= debug(@ec2_images_amazon) %>
87
+
88
+ <h1>Sample 2 - Build a table</h1>
89
+
90
+ <table border='1'>
91
+ <tr>
92
+ <th>image.imageId</th>
93
+ <th>image.imageLocation</th>
94
+ <th>image.imageOwnerId</th>
95
+ <th>image.imageState</th>
96
+ <th>image.isPublic</th>
97
+ </tr>
98
+
99
+ <% for image in @ec2_images_amazon %>
100
+ <tr>
101
+ <td><%=h image.imageId %></td>
102
+ <td><%=h image.imageLocation %></td>
103
+ <td><%=h image.imageOwnerId %></td>
104
+ <td><%=h image.imageState %></td>
105
+ <td><%=h image.isPublic %></td>
106
+ </tr>
107
+ <% end %>
108
+ </table>
109
+
110
+ <h1>Sample 3 - Iterate</h1>
111
+
112
+ <% @ec2_images_amazon.each do |image| %>
113
+ <% image.each_pair do |key, value| %>
114
+ <% unless key == 'parent' %>
115
+ <%= "#{key} => #{value}" %><br />
116
+ <% end %>
117
+ <% end %>
118
+ <br />
119
+ <% end %>
120
+
121
+
122
+ == Additional Resources
123
+
124
+ === Information
125
+
126
+ * Amazon Web Services : http://aws.amazon.com
127
+ * amazon-ec2 GEM home : http://amazon-ec2.rubyforge.org
128
+
129
+ === Project Tools
130
+
131
+ * Project Home : http://rubyforge.org/projects/amazon-ec2
132
+ * Downloads : http://rubyforge.org/frs/?group_id=2753
133
+ * Browse Code : http://rubyforge.org/scm/?group_id=2753
134
+ * Report Bugs : http://rubyforge.org/tracker/?group_id=2753
135
+ * Request Features : http://rubyforge.org/tracker/?group_id=2753
136
+ * Submit Patches : http://rubyforge.org/tracker/?group_id=2753
137
+
138
+ === Related Projects
139
+
140
+ * Capsize : http://capsize.rubyforge.org
141
+
142
+ == Credits
143
+
144
+ The original sample code for this library was provided by Amazon Web Services, LLC. Thanks to them for providing all of us with samples that got this started.
145
+
146
+ Thanks to Dr. Nic Williams and his great 'NewGem' Ruby Gem Generator. This "gem" of a Gem helped me package up this code for distribution in a relative flash! You can find Dr. Nic's NewGem generator at http://newgem.rubyforge.org.
147
+
148
+ == Contact
149
+
150
+ Comments, patches, and bug reports are welcome. Send an email to mailto:grempe@nospam@rubyforge.org or use the RubyForge forum for this project.
151
+
152
+ Enjoy!
153
+
154
+ Glenn Rempe