amazon-ec2 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,116 +1,187 @@
1
- === 0.0.8 2007-05-30
2
- * Repackaged with updated newgem generator v. 0.10.3 from http://newgem.rubyforge.org/ to take advantage of new deployment goodness.
1
+ === 0.2.0 2007-06-01
2
+
3
+ * MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
4
+ the way in which you make calls, handle responses, and rescue exceptions from this library.
5
+ If you prefer not to make these changes you can feel free to continue to use the older version
6
+ of the gem. These older versions however will no longer be maintained.
7
+
8
+ * MAJOR refactoring of how methods calls are made. Now all methods are called with a simple hash
9
+ of arguments and none of them are positional. This feels much more "Ruby'ish".
10
+
11
+ * MAJOR refactoring of how responses are returned to users. No longer do you have to call the
12
+ .parse method, and no longer are you getting back simple arrays of information. Responses
13
+ now come in the form of OpenStruct objects that contain all of the data for an object in
14
+ Enumerable form so you can use iterators (.each, .each_pair, etc). All methods return an EC2::Response object
15
+ which inherits from OpenStruct. The return data from EC2, which is in XML form, is parsed
16
+ with XmlSimple and is used to directly construct the return data structure. This allows us
17
+ to know with some confidence that the data structure returned from AWS will always be consistent
18
+ with this library's responses. There is also an .xml attribute for each response object that lets you
19
+ see the full and complete XML response from AWS if that is useful to you.
20
+
21
+ * Added an exception framework which will now throw appropriate Ruby exceptions
22
+ that match those handed to us by Amazon EC2. ArgumentError exceptions will also
23
+ be thrown if you are making calls we know to be illegal or malformed. You should rescue
24
+ these exceptions in your application instead of parsing text responses. All exceptions
25
+ descend from EC2::Error. You can see them all in exceptions.rb in the gem install.
26
+
27
+ * Added a full suite of test/spec unit tests which currently cover 100% of the public methods
28
+ in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
29
+ the reliability of the library as well as our confidence in the code.
30
+ We used to have 0% test coverage. :-/
31
+
32
+ * Added an EC2 command shell : 'ec2sh' which can be called from anywhere and gives you
33
+ an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
34
+ to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
35
+ or @ec2.describe_images to test it out. You must first setup two shell environment variables
36
+ which contain your ACCESS_KEY_ID and SECRET_ACCESS_KEY for this to work. Otherwise an error
37
+ will be thrown when you try to start it. This is way cool and shamelessly borrowed from
38
+ Marcel Molina's fine AWS::S3 library.
39
+
40
+ * Updated API version in the query API request to 2007-01-19, and added all known method calls
41
+ in this version of the API to the gem (including reboot, viewing console output, NAT addressing
42
+ and more!)
43
+
44
+ * Removed .parse method as it is no longer needed or wanted.
45
+
46
+ * Removed 'verbose' attribute writer and a couple of related debug 'puts' calls in EC2.rb.
47
+
48
+ * Removed deprecated alias's used in the library that were added in v0.0.3
49
+
50
+ * Gem now requires XmlSimple gem to be installed.
51
+
52
+
53
+ === 0.1.0 2007-05-30
54
+
55
+ * Repackaged with updated newgem generator v. 0.10.3 from http://newgem.rubyforge.org/ to take advantage of new deployment goodness.
3
56
 
4
- === 0.0.7 2007-03-15
5
- * Applied patch from Kevin Clark which does the following:
6
- * New method to the instances.rb to allow for issuing a reboot command to an EC2 instance.
7
- * New Mocha based tests (Mocha test suite must be installed to run tests. 'sudo gem install mocha')
8
- * Cleanup of the test directory.
9
- * Applied patch from Randy Bias related to CGI escaping error. From his notes:
10
57
 
11
- I finally figured out what was going on. It was a compound problem. The first being that you can't CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64 encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ? and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding, these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks like Amazon's side is doing the right thing and is signing the padding. So, the signatures mis-match.
58
+ === 0.0.7 2007-03-15
12
59
 
13
- I've got the complete patch here and it's about as elegant/clean as I could make it in a short period of time. It's a little tough to strip those equal signs when there are so many in the URI. I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping out all '&' and '?' and only the first '='. Then stitching it back together.
60
+ * Applied patch from Kevin Clark which does the following:
61
+ * New method to the instances.rb to allow for issuing a reboot command to an EC2 instance.
62
+ * New Mocha based tests (Mocha test suite must be installed to run tests. 'sudo gem install mocha')
63
+ * Cleanup of the test directory.
64
+ * Applied patch from Randy Bias related to CGI escaping error. From his notes:
65
+
66
+ I finally figured out what was going on. It was a compound problem. The first being that you can't
67
+ CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
68
+ encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
69
+ and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
70
+ these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
71
+ like Amazon's side is doing the right thing and is signing the padding. So, the signatures mis-match.
72
+
73
+ I've got the complete patch here and it's about as elegant/clean as I could make it in a short
74
+ period of time. It's a little tough to strip those equal signs when there are so many in the URI.
75
+ I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
76
+ out all '&' and '?' and only the first '='. Then stitching it back together.
14
77
 
15
78
 
16
79
  === 0.0.6 2007-03-02
17
- * Patched instances.rb with a bugfix and patch provided by Randy Bias (Thanks Randy!).
18
- Only minimally tested so please let me know if this causes any problems for anyone.
80
+ * Patched instances.rb with a bugfix and patch provided by Randy Bias (Thanks Randy!).
81
+ Only minimally tested so please let me know if this causes any problems for anyone.
82
+
83
+ From his notes:
84
+ I wanted to let you know that there appears to be a bug in how user data is passed. In
85
+ instances.rb the line that creates the base64 encoded package of user data is as follows:
86
+
87
+ userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
88
+
89
+ This may have worked prior, but at least right now the CGI::escape appears to cause a
90
+ breakage. More specifically it turns something like this (the actual base64 encoded string):
91
+
92
+ YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
93
+ eHh4eHh4eHh4eHh4eHh4eHh4eHgg
94
+
95
+ Into this:
96
+
97
+ YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
98
+ 0AeHh4eHh4eHh4eHh4eHh4eHh4eHgg
99
+
100
+ And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
101
+ Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
102
+ EOL at every 47 chars, no matter what:
103
+
104
+ ---
105
+ [randyb@master randyb] cat /tmp/foo.rb
106
+ #!/usr/bin/env ruby
107
+ #
108
+ require 'rubygems'
109
+ require_gem 'amazon-ec2'
110
+ require 'getoptlong'
111
+ puts Base64.encode64
112
+ ("012345678901234567890123456789012345678901234567890123456789")
113
+
114
+ [randyb@master randyb] /tmp/foo.rb
115
+ MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
116
+ NTY3ODkwMTIzNDU2Nzg5
117
+ ---
118
+
119
+ The best way to handle this is to strip the CRLFs/EOLs before passing to CGI.escape.
19
120
 
20
- From his notes:
21
- I wanted to let you know that there appears to be a bug in how user data is passed. In
22
- instances.rb the line that creates the base64 encoded package of user data is as follows:
23
121
 
24
- userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
25
-
26
- This may have worked prior, but at least right now the
27
- CGI::escape appears to cause a breakage. More specifically it
28
- turns something like this (the actual base64 encoded string):
122
+ === 0.0.5 2006-12-21
29
123
 
30
- YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
31
- eHh4eHh4eHh4eHh4eHh4eHh4eHgg
124
+ * Changes to home page documentation and example files to indicate that you
125
+ should use 'require_gem' instead of a simple require. Not sure if this
126
+ is a result of something I am doing in the packaging of the gem that is
127
+ incorrect or if this is right and proper. I will investigate further.
128
+ * Patched instances.rb run_instances method to allow for submission of
129
+ user data with the command to start an instance. Patch submitted
130
+ anonymously on RubyForge. This had not been functionally implemented
131
+ in the Amazon Web Services sample library prior to this patch.
132
+ * Added simple framework for adding unit tests for the library under test dir.
133
+ No functional unit tests exist yet.
32
134
 
33
- Into this:
34
135
 
35
- YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
36
- 0AeHh4eHh4eHh4eHh4eHh4eHh4eHgg
136
+ === 0.0.4 2006-12-21
37
137
 
38
- And it looks like EC2 chokes on the %0, which is CGI::escape's
39
- way for handling an EOL. Unfortunately, the Base64.encode64 (at
40
- least in my 1.8.5 version of Ruby) inserts a EOL at every 47 chars,
41
- no matter what:
138
+ * Applied patch from Kevin Clark to svn version 7. Thanks for the
139
+ patch and the description Kevin! Please report if you
140
+ encounter any issues with this patched version. Here is Kevin's
141
+ description which I requested : "It helps me to think of modules as boxes full of classes and
142
+ methods. REXML is a module which holds various classes related to parsing XML
143
+ including REXML::Node, REXML::Document and REXML::XPath. When you
144
+ include a module it takes everything out of the box and places it in
145
+ the local context. So, when you include REXML in the global namespace
146
+ on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
147
+ global object space. This means that I can't have a class called Node
148
+ in my own project (which I do). The library would be a much better
149
+ neighbor if it instead accessed the REXML::Document and REXML::XPath
150
+ classes explicitly through the module."
42
151
 
43
- ---
44
- [randyb@master randyb] cat /tmp/foo.rb
45
- #!/usr/bin/env ruby
46
- #
47
- require 'rubygems'
48
- require_gem 'amazon-ec2'
49
- require 'getoptlong'
50
- puts Base64.encode64
51
- ("012345678901234567890123456789012345678901234567890123456789")
52
152
 
53
- [randyb@master randyb] /tmp/foo.rb
54
- MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
55
- NTY3ODkwMTIzNDU2Nzg5
56
- ---
153
+ === 0.0.3 2006-12-16
57
154
 
58
- The best way to handle this is to strip the CRLFs/EOLs before passing to CGI.escape.
155
+ * API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
156
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
157
+ * API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
158
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'revoke' for backwards compatibility.
159
+ * API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
160
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'delete_securitygroup' for backwards compatibility.
161
+ * API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
162
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'describe_securitygroups' for backwards compatibility.
163
+ * API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
164
+ naming of Ruby library methods to match AWS EC2 API actions. Alias to 'create_securitygroup' for backwards compatibility.
165
+ * Added many API rdoc's, some method descriptions copied from Amazon Query API Developer Guide.
166
+ * Extracted some parts of the formerly monolithic EC2 library out into separate files for manageability.
167
+ * Changed the HTTP 'User-Agent' string used for each request so that we have our own user agent
168
+ to identify this library's calls. Now set the version # in the user agent string based on the
169
+ master version number for this library which is stored in lib/EC2/version.rb and should only
170
+ be defined in one place.
171
+ * Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
172
+ "warning: peer certificate won't be verified in this SSL session". File EC2.rb:96
173
+ * Make 'pathlist' utility method a private method (EC2.rb:111). No reason I can see for this to be exposed.
59
174
 
60
175
 
61
- === 0.0.5 2006-12-21
62
- * Changes to home page documentation and example files to indicate that you
63
- should use 'require_gem' instead of a simple require. Not sure if this
64
- is a result of something I am doing in the packaging of the gem that is
65
- incorrect or if this is right and proper. I will investigate further.
66
- * Patched instances.rb run_instances method to allow for submission of
67
- user data with the command to start an instance. Patch submitted
68
- anonymously on RubyForge. This had not been functionally implemented
69
- in the Amazon Web Services sample library prior to this patch.
70
- * Added simple framework for adding unit tests for the library under test dir.
71
- No functional unit tests exist yet.
72
-
73
- === 0.0.4 2006-12-21
74
- * Applied patch from Kevin Clark to svn version 7. Thanks for the
75
- patch and the description Kevin! Please report if you
76
- encounter any issues with this patched version. Here is Kevin's
77
- description which I requested : "It helps me to think of modules as boxes full of classes and
78
- methods. REXML is a module which holds various classes related to parsing XML
79
- including REXML::Node, REXML::Document and REXML::XPath. When you
80
- include a module it takes everything out of the box and places it in
81
- the local context. So, when you include REXML in the global namespace
82
- on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
83
- global object space. This means that I can't have a class called Node
84
- in my own project (which I do). The library would be a much better
85
- neighbor if it instead accessed the REXML::Document and REXML::XPath
86
- classes explicitly through the module."
176
+ === 0.0.2 2006-12-14
87
177
 
88
- === 0.0.3 2006-12-16
89
- * API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
90
- naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
91
- * API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
92
- naming of Ruby library methods to match AWS EC2 API actions. Alias to 'revoke' for backwards compatibility.
93
- * API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
94
- naming of Ruby library methods to match AWS EC2 API actions. Alias to 'delete_securitygroup' for backwards compatibility.
95
- * API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
96
- naming of Ruby library methods to match AWS EC2 API actions. Alias to 'describe_securitygroups' for backwards compatibility.
97
- * API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
98
- naming of Ruby library methods to match AWS EC2 API actions. Alias to 'create_securitygroup' for backwards compatibility.
99
- * Added many API rdoc's, some method descriptions copied from Amazon Query API Developer Guide.
100
- * Extracted some parts of the formerly monolithic EC2 library out into separate files for manageability.
101
- * Changed the HTTP 'User-Agent' string used for each request so that we have our own user agent
102
- to identify this library's calls. Now set the version # in the user agent string based on the
103
- master version number for this library which is stored in lib/EC2/version.rb and should only
104
- be defined in one place.
105
- * Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
106
- "warning: peer certificate won't be verified in this SSL session". File EC2.rb:96
107
- * Make 'pathlist' utility method a private method (EC2.rb:111). No reason I can see for this to be exposed.
178
+ * Bugfix in run_instances method. Method works now. Patch submitted by Stephen Caudill on AWS forums. Thanks!
108
179
 
109
- === 0.0.2 2006-12-14
110
- * Bugfix in run_instances method. Method works now. Patch submitted by Stephen Caudill on AWS forums. Thanks!
111
180
 
112
181
  === 0.0.1 2006-12-13
113
- * Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
114
- Amazon Web Services as example code. No changes or enhancements to that code were made other than
115
- packaging it as a Ruby Gem.
116
- * RubyForge project created. http://amazon-ec2.rubyforge.org
182
+
183
+ * Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
184
+ Amazon Web Services as example code. No changes or enhancements to that code were made other than
185
+ packaging it as a Ruby Gem.
186
+ * RubyForge project created. http://amazon-ec2.rubyforge.org
187
+
data/License.txt CHANGED
@@ -1,20 +1,67 @@
1
- Copyright (c) 2007 Glenn Rempe
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2007 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.
67
+
data/Manifest.txt CHANGED
@@ -1,10 +1,10 @@
1
- examples/ec2-example.rb
2
1
  History.txt
3
- License.txt
4
- Manifest.txt
5
- README.txt
6
- Rakefile
2
+ bin/ec2sh
3
+ bin/ec2-gem-example.rb
4
+ bin/setup.rb
7
5
  lib/EC2.rb
6
+ lib/EC2/console.rb
7
+ lib/EC2/exceptions.rb
8
8
  lib/EC2/version.rb
9
9
  lib/EC2/responses.rb
10
10
  lib/EC2/images.rb
@@ -12,11 +12,22 @@ lib/EC2/instances.rb
12
12
  lib/EC2/keypairs.rb
13
13
  lib/EC2/image_attributes.rb
14
14
  lib/EC2/security_groups.rb
15
+ License.txt
16
+ Manifest.txt
17
+ Rakefile
18
+ README.txt
15
19
  scripts/txt2html
16
20
  setup.rb
17
21
  test/test_EC2.rb
22
+ test/test_EC2_console.rb
23
+ test/test_EC2_image_attributes.rb
24
+ test/test_EC2_images.rb
25
+ test/test_EC2_instances.rb
26
+ test/test_EC2_keypairs.rb
27
+ test/test_EC2_responses.rb
28
+ test/test_EC2_security_groups.rb
29
+ test/test_EC2_version.rb
18
30
  test/test_helper.rb
19
- test/test_responses.rb
20
31
  website/index.html
21
32
  website/index.txt
22
33
  website/javascripts/rounded_corners_lite.inc.js
data/README.txt CHANGED
@@ -1,2 +1,112 @@
1
- = README.txt
2
- * Please see the project homepage at: http://amazon-ec2.rubyforge.org/
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 more 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
+ #!/usr/bin/env ruby
38
+
39
+ require 'rubygems'
40
+ require 'ec2'
41
+
42
+ ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--'
43
+ SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--'
44
+
45
+ ec2 = EC2::Base.new(ACCESS_KEY_ID, SECRET_ACCESS_KEY)
46
+
47
+ puts "----- listing images -----"
48
+ ec2.describe_images.each do |image|
49
+ image.members.each do |member|
50
+ puts "#{member} => #{image[member]}"
51
+ end
52
+ end
53
+
54
+ === Ruby on Rails usage example:
55
+
56
+ <b>config/environment.rb</b>
57
+
58
+ require 'EC2'
59
+
60
+ <b>app/controllers/my_controller.rb</b>
61
+
62
+ class MyController < ApplicationController
63
+ def index
64
+ # Setup connection to Amazon EC2
65
+ ec2 = EC2::Base.new("YOUR AWS ACCESS KEY ID", "YOUR AWS SECRET ACCESS KEY")
66
+ @ec2_images = ec2.describe_images()
67
+ end
68
+ end
69
+
70
+ <b>app/views/my/index.rhtml</b>
71
+
72
+ <% for image in @ec2_images %>
73
+ <% for member in image.members %>
74
+ <%= "#{member} => #{image[member]}" %><br />
75
+ <% end %>
76
+ <br />
77
+ <% end %>
78
+
79
+
80
+ == Additional Resources
81
+
82
+ === Information
83
+
84
+ * Amazon Web Services : http://aws.amazon.com
85
+ * amazon-ec2 GEM home : http://amazon-ec2.rubyforge.org
86
+
87
+ === Project Tools
88
+
89
+ * Project Home : http://rubyforge.org/projects/amazon-ec2
90
+ * Downloads : http://rubyforge.org/frs/?group_id=2753
91
+ * Browse Code : http://rubyforge.org/scm/?group_id=2753
92
+ * Report Bugs : http://rubyforge.org/tracker/?group_id=2753
93
+ * Request Features : http://rubyforge.org/tracker/?group_id=2753
94
+ * Submit Patches : http://rubyforge.org/tracker/?group_id=2753
95
+
96
+ === Related Projects
97
+
98
+ * Capazon : http://capazon.rubyforge.org
99
+
100
+ == Credits
101
+
102
+ 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.
103
+
104
+ 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.
105
+
106
+ == Contact
107
+
108
+ Comments, patches, and bug reports are welcome. Send an email to mailto:grempe@nospam@rubyforge.org or use the RubyForge forum for this project.
109
+
110
+ Enjoy!
111
+
112
+ Glenn Rempe