amazon-ec2 0.2.15 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +86 -73
- data/README.rdoc +21 -18
- data/Rakefile +0 -1
- data/bin/ec2-gem-example.rb +12 -12
- data/bin/ec2sh +2 -2
- data/bin/setup.rb +5 -5
- data/lib/EC2.rb +3 -3
- data/lib/EC2/availability_zones.rb +4 -5
- data/lib/EC2/console.rb +3 -3
- data/lib/EC2/elastic_ips.rb +2 -2
- data/lib/EC2/exceptions.rb +2 -2
- data/lib/EC2/image_attributes.rb +2 -2
- data/lib/EC2/images.rb +2 -2
- data/lib/EC2/instances.rb +5 -2
- data/lib/EC2/keypairs.rb +2 -2
- data/lib/EC2/products.rb +3 -3
- data/lib/EC2/responses.rb +20 -131
- data/lib/EC2/security_groups.rb +2 -2
- data/lib/EC2/snapshots.rb +94 -0
- data/lib/EC2/volumes.rb +170 -0
- data/test/test_EC2.rb +2 -2
- data/test/test_EC2_availability_zones.rb +4 -4
- data/test/test_EC2_console.rb +4 -4
- data/test/test_EC2_elastic_ips.rb +7 -7
- data/test/test_EC2_image_attributes.rb +12 -12
- data/test/test_EC2_images.rb +6 -6
- data/test/test_EC2_instances.rb +17 -12
- data/test/test_EC2_keypairs.rb +5 -5
- data/test/test_EC2_products.rb +3 -3
- data/test/test_EC2_responses.rb +15 -65
- data/test/test_EC2_security_groups.rb +7 -7
- data/test/test_EC2_snapshots.rb +83 -0
- data/test/test_EC2_volumes.rb +142 -0
- data/test/test_helper.rb +3 -4
- metadata +10 -33
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 0.3.1 2008-09-18
|
2
|
+
* Added basic custom kernel id support to run_instances. Thanks to Keith Hudgins for the patch.
|
3
|
+
|
4
|
+
=== 0.3.0 2008-08-24
|
5
|
+
* Changed response object from AmazonEC2::Response to Hash (patch from Yan Pritzker 'skwp') Thanks!
|
6
|
+
* Added support for Elastic Block Storage (patch from Yann Klis 'yannski') Thanks!
|
7
|
+
* Bumped AWS EC2 API version to 2008-05-05
|
8
|
+
* Bumped gem version number
|
9
|
+
* Whitespace cleanup
|
10
|
+
|
11
|
+
=== 0.2.15 2008-08-20
|
12
|
+
* Updated gem install instructions, and dependency specifications in the gemspec.
|
13
|
+
|
1
14
|
=== 0.2.14 2008-06-30
|
2
15
|
* Merged patch from 'orionz' which adds support for EC2 Availability Zones. Thanks!
|
3
16
|
|
@@ -40,10 +53,10 @@
|
|
40
53
|
Now it looks like: require 'xmlsimple' unless defined? XmlSimple
|
41
54
|
|
42
55
|
=== 0.2.3 2007-07-06
|
43
|
-
* Updated gem to work with new official release of AWS API version 2007-03-01 which occurred
|
56
|
+
* Updated gem to work with new official release of AWS API version 2007-03-01 which occurred
|
44
57
|
on July 6, 2007.
|
45
|
-
* Added support for primary new feature which supports Paid AMI's and the product codes
|
46
|
-
associated with them. Modified several methods to support this change, updated the test
|
58
|
+
* Added support for primary new feature which supports Paid AMI's and the product codes
|
59
|
+
associated with them. Modified several methods to support this change, updated the test
|
47
60
|
cases, and added a new method EC2#confirm_product_instance.
|
48
61
|
|
49
62
|
=== 0.2.2 2007-07-03
|
@@ -54,47 +67,47 @@
|
|
54
67
|
|
55
68
|
=== 0.2.0 2007-07-03
|
56
69
|
|
57
|
-
* MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
|
58
|
-
the way in which you make calls, handle responses, and rescue exceptions from this library.
|
59
|
-
If you prefer not to make these changes you can feel free to continue to use the older version
|
70
|
+
* MAJOR library changes : THESE CHANGES ARE NOT BACKWARD COMPATIBLE!! You will need to update
|
71
|
+
the way in which you make calls, handle responses, and rescue exceptions from this library.
|
72
|
+
If you prefer not to make these changes you can feel free to continue to use the older version
|
60
73
|
of the gem. These older versions however will no longer be maintained.
|
61
|
-
|
74
|
+
|
62
75
|
* MAJOR refactoring of how methods calls are made. Now all methods are called with a simple hash
|
63
76
|
of arguments and none of them are positional. This feels much more "Ruby'ish".
|
64
|
-
|
65
|
-
* MAJOR refactoring of how responses are returned to users. No longer do you have to call the
|
66
|
-
.parse method, and no longer are you getting back simple arrays of information. Responses
|
67
|
-
now come in the form of OpenStruct objects that contain all of the data for an object in
|
77
|
+
|
78
|
+
* MAJOR refactoring of how responses are returned to users. No longer do you have to call the
|
79
|
+
.parse method, and no longer are you getting back simple arrays of information. Responses
|
80
|
+
now come in the form of OpenStruct objects that contain all of the data for an object in
|
68
81
|
Enumerable form so you can use iterators (.each, .each_pair, etc). All methods return an EC2::Response object
|
69
82
|
which inherits from OpenStruct. The return data from EC2, which is in XML form, is parsed
|
70
83
|
with XmlSimple and is used to directly construct the return data structure. This allows us
|
71
84
|
to know with some confidence that the data structure returned from AWS will always be consistent
|
72
|
-
with this library's responses. There is also an .xml attribute for each response object that lets you
|
85
|
+
with this library's responses. There is also an .xml attribute for each response object that lets you
|
73
86
|
see the full and complete XML response from AWS if that is useful to you.
|
74
|
-
|
87
|
+
|
75
88
|
* Added an exception framework which will now throw appropriate Ruby exceptions
|
76
89
|
that match those handed to us by Amazon EC2. ArgumentError exceptions will also
|
77
|
-
be thrown if you are making calls we know to be illegal or malformed. You should rescue
|
78
|
-
these exceptions in your application instead of parsing text responses. All exceptions
|
90
|
+
be thrown if you are making calls we know to be illegal or malformed. You should rescue
|
91
|
+
these exceptions in your application instead of parsing text responses. All exceptions
|
79
92
|
descend from EC2::Error. You can see them all in exceptions.rb in the gem install.
|
80
|
-
|
93
|
+
|
81
94
|
* Added a full suite of test/spec unit tests which currently cover 100% of the public methods
|
82
|
-
in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
|
83
|
-
the reliability of the library as well as our confidence in the code.
|
84
|
-
We used to have 0% test coverage. :-/
|
85
|
-
|
95
|
+
in this library. We have abot 92% code coverage according to rcov. This has greatly enhanced
|
96
|
+
the reliability of the library as well as our confidence in the code.
|
97
|
+
We used to have 0% test coverage. :-/
|
98
|
+
|
86
99
|
* Added an EC2 command shell : 'ec2sh' which can be called from anywhere and gives you
|
87
|
-
an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
|
88
|
-
to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
|
100
|
+
an interactive irb session with an EC2 connection pre-made for you as @ec2. You can use this
|
101
|
+
to interactively execute any command on EC2 that this library supports. Try @ec2.methods.sort
|
89
102
|
or @ec2.describe_images to test it out. You must first setup two shell environment variables
|
90
103
|
which contain your ACCESS_KEY_ID and SECRET_ACCESS_KEY for this to work. Otherwise an error
|
91
|
-
will be thrown when you try to start it. This is way cool and shamelessly borrowed from
|
104
|
+
will be thrown when you try to start it. This is way cool and shamelessly borrowed from
|
92
105
|
Marcel Molina's fine AWS::S3 library.
|
93
|
-
|
106
|
+
|
94
107
|
* Updated API version in the query API request to 2007-01-19, and added all known method calls
|
95
|
-
in this version of the API to the gem (including reboot, viewing console output, NAT addressing
|
108
|
+
in this version of the API to the gem (including reboot, viewing console output, NAT addressing
|
96
109
|
and more!)
|
97
|
-
|
110
|
+
|
98
111
|
* Removed .parse method as it is no longer needed or wanted.
|
99
112
|
|
100
113
|
* Removed 'verbose' attribute writer and a couple of related debug 'puts' calls in EC2.rb.
|
@@ -116,43 +129,43 @@
|
|
116
129
|
* New Mocha based tests (Mocha test suite must be installed to run tests. 'sudo gem install mocha')
|
117
130
|
* Cleanup of the test directory.
|
118
131
|
* Applied patch from Randy Bias related to CGI escaping error. From his notes:
|
119
|
-
|
120
|
-
I finally figured out what was going on. It was a compound problem. The first being that you can't
|
121
|
-
CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
|
122
|
-
encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
|
123
|
-
and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
|
124
|
-
these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
|
132
|
+
|
133
|
+
I finally figured out what was going on. It was a compound problem. The first being that you can't
|
134
|
+
CGI::encode the UserData early. You have to just Base64 encode it. Unfortunately, when you Base64
|
135
|
+
encode it, it means that some encodings will be padded with extra chars, specifically the '=', but &, ?
|
136
|
+
and = get stripped by EC2.canonial_string. So if a Base64 encoding has trailing ='s for padding,
|
137
|
+
these get stripped and then you sign the UserData Base64 payload sans the padding. But it looks
|
125
138
|
like Amazon's side is doing the right thing and is signing the padding. So, the signatures mis-match.
|
126
|
-
|
127
|
-
I've got the complete patch here and it's about as elegant/clean as I could make it in a short
|
128
|
-
period of time. It's a little tough to strip those equal signs when there are so many in the URI.
|
129
|
-
I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
|
139
|
+
|
140
|
+
I've got the complete patch here and it's about as elegant/clean as I could make it in a short
|
141
|
+
period of time. It's a little tough to strip those equal signs when there are so many in the URI.
|
142
|
+
I think this works pretty well, though. I'm splitting the URI on '&', then for each field ripping
|
130
143
|
out all '&' and '?' and only the first '='. Then stitching it back together.
|
131
144
|
|
132
145
|
|
133
146
|
=== 0.0.6 2007-03-02
|
134
147
|
* Patched instances.rb with a bugfix and patch provided by Randy Bias (Thanks Randy!).
|
135
148
|
Only minimally tested so please let me know if this causes any problems for anyone.
|
136
|
-
|
149
|
+
|
137
150
|
From his notes:
|
138
|
-
I wanted to let you know that there appears to be a bug in how user data is passed. In
|
151
|
+
I wanted to let you know that there appears to be a bug in how user data is passed. In
|
139
152
|
instances.rb the line that creates the base64 encoded package of user data is as follows:
|
140
|
-
|
153
|
+
|
141
154
|
userData = CGI::escape(Base64.encode64(in_params[:userData]).strip())
|
142
|
-
|
143
|
-
This may have worked prior, but at least right now the CGI::escape appears to cause a
|
155
|
+
|
156
|
+
This may have worked prior, but at least right now the CGI::escape appears to cause a
|
144
157
|
breakage. More specifically it turns something like this (the actual base64 encoded string):
|
145
158
|
|
146
159
|
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
|
147
160
|
eHh4eHh4eHh4eHh4eHh4eHh4eHgg
|
148
|
-
|
161
|
+
|
149
162
|
Into this:
|
150
|
-
|
151
|
-
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
|
163
|
+
|
164
|
+
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh%
|
152
165
|
0AeHh4eHh4eHh4eHh4eHh4eHh4eHgg
|
153
|
-
|
154
|
-
And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
|
155
|
-
Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
|
166
|
+
|
167
|
+
And it looks like EC2 chokes on the %0, which is CGI::escape's way for handling an EOL.
|
168
|
+
Unfortunately, the Base64.encode64 (at least in my 1.8.5 version of Ruby) inserts a
|
156
169
|
EOL at every 47 chars, no matter what:
|
157
170
|
|
158
171
|
---
|
@@ -162,9 +175,9 @@
|
|
162
175
|
require 'rubygems'
|
163
176
|
require_gem 'amazon-ec2'
|
164
177
|
require 'getoptlong'
|
165
|
-
puts Base64.encode64
|
178
|
+
puts Base64.encode64
|
166
179
|
("012345678901234567890123456789012345678901234567890123456789")
|
167
|
-
|
180
|
+
|
168
181
|
[randyb@master randyb] /tmp/foo.rb
|
169
182
|
MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0
|
170
183
|
NTY3ODkwMTIzNDU2Nzg5
|
@@ -175,28 +188,28 @@
|
|
175
188
|
|
176
189
|
=== 0.0.5 2006-12-21
|
177
190
|
|
178
|
-
* Changes to home page documentation and example files to indicate that you
|
179
|
-
should use 'require_gem' instead of a simple require. Not sure if this
|
180
|
-
is a result of something I am doing in the packaging of the gem that is
|
191
|
+
* Changes to home page documentation and example files to indicate that you
|
192
|
+
should use 'require_gem' instead of a simple require. Not sure if this
|
193
|
+
is a result of something I am doing in the packaging of the gem that is
|
181
194
|
incorrect or if this is right and proper. I will investigate further.
|
182
|
-
* Patched instances.rb run_instances method to allow for submission of
|
183
|
-
user data with the command to start an instance. Patch submitted
|
195
|
+
* Patched instances.rb run_instances method to allow for submission of
|
196
|
+
user data with the command to start an instance. Patch submitted
|
184
197
|
anonymously on RubyForge. This had not been functionally implemented
|
185
198
|
in the Amazon Web Services sample library prior to this patch.
|
186
|
-
* Added simple framework for adding unit tests for the library under test dir.
|
199
|
+
* Added simple framework for adding unit tests for the library under test dir.
|
187
200
|
No functional unit tests exist yet.
|
188
201
|
|
189
202
|
|
190
203
|
=== 0.0.4 2006-12-21
|
191
204
|
|
192
|
-
* Applied patch from Kevin Clark to svn version 7. Thanks for the
|
193
|
-
patch and the description Kevin! Please report if you
|
194
|
-
encounter any issues with this patched version. Here is Kevin's
|
195
|
-
description which I requested : "It helps me to think of modules as boxes full of classes and
|
205
|
+
* Applied patch from Kevin Clark to svn version 7. Thanks for the
|
206
|
+
patch and the description Kevin! Please report if you
|
207
|
+
encounter any issues with this patched version. Here is Kevin's
|
208
|
+
description which I requested : "It helps me to think of modules as boxes full of classes and
|
196
209
|
methods. REXML is a module which holds various classes related to parsing XML
|
197
210
|
including REXML::Node, REXML::Document and REXML::XPath. When you
|
198
211
|
include a module it takes everything out of the box and places it in
|
199
|
-
the local context. So, when you include REXML in the global namespace
|
212
|
+
the local context. So, when you include REXML in the global namespace
|
200
213
|
on line 27 of EC2.rb, it includes classes called Node, Document and XPath in the
|
201
214
|
global object space. This means that I can't have a class called Node
|
202
215
|
in my own project (which I do). The library would be a much better
|
@@ -206,23 +219,23 @@
|
|
206
219
|
|
207
220
|
=== 0.0.3 2006-12-16
|
208
221
|
|
209
|
-
* API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
|
222
|
+
* API CHANGE : Changed method name 'authorize' to 'authorize_security_group_ingress' to ensure consistent
|
210
223
|
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'authorize' for backwards compatibility.
|
211
|
-
* API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
|
212
|
-
|
213
|
-
* API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
|
214
|
-
|
215
|
-
* API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
|
216
|
-
|
217
|
-
* API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
|
218
|
-
|
224
|
+
* API CHANGE : Changed method name 'revoke' to 'revoke_security_group_ingress' to ensure consistent
|
225
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'revoke' for backwards compatibility.
|
226
|
+
* API CHANGE : Changed method name 'delete_securitygroup' to 'delete_security_group' to ensure consistent
|
227
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'delete_securitygroup' for backwards compatibility.
|
228
|
+
* API CHANGE : Changed method name 'describe_securitygroups' to 'describe_security_group' to ensure consistent
|
229
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'describe_securitygroups' for backwards compatibility.
|
230
|
+
* API CHANGE : Changed method name 'create_securitygroup' to 'create_security_group' to ensure consistent
|
231
|
+
naming of Ruby library methods to match AWS EC2 API actions. Alias to 'create_securitygroup' for backwards compatibility.
|
219
232
|
* Added many API rdoc's, some method descriptions copied from Amazon Query API Developer Guide.
|
220
233
|
* Extracted some parts of the formerly monolithic EC2 library out into separate files for manageability.
|
221
234
|
* Changed the HTTP 'User-Agent' string used for each request so that we have our own user agent
|
222
235
|
to identify this library's calls. Now set the version # in the user agent string based on the
|
223
236
|
master version number for this library which is stored in lib/EC2/version.rb and should only
|
224
237
|
be defined in one place.
|
225
|
-
* Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
|
238
|
+
* Set @http.verify_mode = OpenSSL::SSL::VERIFY_NONE to avoid seeing SSL Cert warning
|
226
239
|
"warning: peer certificate won't be verified in this SSL session". File EC2.rb:96
|
227
240
|
* Make 'pathlist' utility method a private method (EC2.rb:111). No reason I can see for this to be exposed.
|
228
241
|
|
@@ -234,7 +247,7 @@
|
|
234
247
|
|
235
248
|
=== 0.0.1 2006-12-13
|
236
249
|
|
237
|
-
* Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
|
238
|
-
Amazon Web Services as example code. No changes or enhancements to that code were made other than
|
250
|
+
* Initial release of the Ruby Gem. This includes the version of the library exactly as provided by
|
251
|
+
Amazon Web Services as example code. No changes or enhancements to that code were made other than
|
239
252
|
packaging it as a Ruby Gem.
|
240
|
-
* RubyForge project created. http://amazon-ec2
|
253
|
+
* RubyForge project created. http://github.com/grempe/amazon-ec2/tree/master
|
data/README.rdoc
CHANGED
@@ -32,20 +32,29 @@ The following gems should be installed automatically as part of your install of
|
|
32
32
|
|
33
33
|
=== Install the amazon-ec2 gem
|
34
34
|
|
35
|
+
# ONE TIME ONLY
|
36
|
+
# It is highly recommended that you are running RubyGems version >= 1.2.0
|
37
|
+
# See : http://blog.segment7.net/articles/2008/06/21/rubygems-1-2-0
|
38
|
+
sudo gem update --system
|
39
|
+
|
35
40
|
# ONE TIME ONLY
|
36
41
|
# Execute this on each machine where you install gems to add GitHub as a gem source
|
37
42
|
# Do this only once or you'll end up with multiple entries in 'gem sources'
|
38
43
|
gem sources -a http://gems.github.com/
|
39
44
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
#
|
44
|
-
sudo gem uninstall amazon-ec2
|
45
|
+
# Install the stable release gem from RubyForge
|
46
|
+
sudo gem install amazon-ec2
|
47
|
+
|
48
|
+
# OR
|
45
49
|
|
46
|
-
#
|
50
|
+
# Install the gem from the GitHub bleeding edge as a normal runtime install
|
47
51
|
sudo gem install grempe-amazon-ec2
|
48
52
|
|
53
|
+
# OR
|
54
|
+
|
55
|
+
# Install the gem from the GitHub bleeding edge with all developer dependencies
|
56
|
+
sudo gem install grempe-amazon-ec2 --development
|
57
|
+
|
49
58
|
== Using amazon-ec2
|
50
59
|
|
51
60
|
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.
|
@@ -147,15 +156,15 @@ If you're not in front of a terminal shell now (perhaps you’re browsing this s
|
|
147
156
|
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).
|
148
157
|
|
149
158
|
#!/usr/bin/env ruby
|
150
|
-
|
159
|
+
|
151
160
|
require 'rubygems'
|
152
161
|
require 'ec2'
|
153
|
-
|
162
|
+
|
154
163
|
ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--'
|
155
164
|
SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--'
|
156
|
-
|
165
|
+
|
157
166
|
ec2 = EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
|
158
|
-
|
167
|
+
|
159
168
|
puts "----- listing images owned by 'amazon' -----"
|
160
169
|
ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
|
161
170
|
# OpenStruct objects have members!
|
@@ -235,7 +244,7 @@ One of the key benefits of this new version of the library is that all responses
|
|
235
244
|
|
236
245
|
$ ec2sh
|
237
246
|
>> puts @ec2.describe_images(:owner_id => 'amazon').xml
|
238
|
-
|
247
|
+
|
239
248
|
<?xml version="1.0"?>
|
240
249
|
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19/">
|
241
250
|
<imagesSet>
|
@@ -303,19 +312,13 @@ EC2 will typically return sets of things (imagesSet, reservationSet, etc.) which
|
|
303
312
|
* Report Bugs / Request Features : http://grempe.lighthouseapp.com/projects/10644-amazon-ec2/overview
|
304
313
|
* Amazon Web Services : http://aws.amazon.com
|
305
314
|
|
306
|
-
=== Related Projects
|
307
|
-
|
308
|
-
Jesse Newland and I created the Capsize project which can help when using Capistrano and EC2 together. You can check out the latest code at:
|
309
|
-
|
310
|
-
http://github.com/jnewland/capsize/tree/master
|
311
|
-
|
312
315
|
== Credits
|
313
316
|
|
314
317
|
The original code for this library was provided by Amazon Web Services, LLC as sample code. Thanks to them for providing all of us with something to get us started.
|
315
318
|
|
316
319
|
== Contact
|
317
320
|
|
318
|
-
Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:glenn
|
321
|
+
Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:glenn@nospam@rempe.us or use the Google Groups forum for this project.
|
319
322
|
|
320
323
|
Enjoy!
|
321
324
|
|
data/Rakefile
CHANGED
data/bin/ec2-gem-example.rb
CHANGED
@@ -3,20 +3,21 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
require 'rubygems'
|
13
13
|
require File.dirname(__FILE__) + '/../lib/EC2'
|
14
|
+
require 'pp'
|
14
15
|
|
15
16
|
# pull these from the local shell environment variables set in ~/.bash_login
|
16
17
|
# or using appropriate methods specific to your login shell.
|
17
|
-
#
|
18
|
+
#
|
18
19
|
# e.g. in ~/.bash_login
|
19
|
-
#
|
20
|
+
#
|
20
21
|
# # For amazon-ec2 and amazon s3 ruby gems
|
21
22
|
# export AMAZON_ACCESS_KEY_ID="FOO"
|
22
23
|
# export AMAZON_SECRET_ACCESS_KEY="BAR"
|
@@ -36,23 +37,22 @@ p ec2.methods.sort
|
|
36
37
|
|
37
38
|
puts "----- listing images owned by 'amazon' -----"
|
38
39
|
ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
|
39
|
-
image.
|
40
|
-
puts "#{
|
40
|
+
image.keys.each do |key|
|
41
|
+
puts "#{key} => #{image[key]}"
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
44
45
|
puts "----- listing all running instances -----"
|
45
|
-
|
46
|
+
pp ec2.describe_instances()
|
46
47
|
|
47
48
|
puts "----- creating a security group -----"
|
48
|
-
|
49
|
+
pp ec2.create_security_group(:group_name => "ec2-example-rb-test-group", :group_description => "ec-example.rb test group description.")
|
49
50
|
|
50
51
|
puts "----- listing security groups -----"
|
51
|
-
|
52
|
+
pp ec2.describe_security_groups()
|
52
53
|
|
53
54
|
puts "----- deleting a security group -----"
|
54
|
-
|
55
|
+
pp ec2.delete_security_group(:group_name => "ec2-example-rb-test-group")
|
55
56
|
|
56
57
|
puts "----- listing my keypairs (verbose mode) -----"
|
57
|
-
|
58
|
-
|
58
|
+
pp ec2.describe_keypairs()
|
data/bin/ec2sh
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
# CREDITS : Credit for this bit of shameful ripoff coolness
|
data/bin/setup.rb
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
# Amazon Web Services EC2 Query API Ruby library
|
4
4
|
#
|
5
5
|
# Ruby Gem Name:: amazon-ec2
|
6
|
-
# Author:: Glenn Rempe (mailto:
|
6
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
7
7
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
8
8
|
# License:: Distributes under the same terms as Ruby
|
9
|
-
# Home:: http://amazon-ec2
|
9
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
10
10
|
#++
|
11
11
|
|
12
12
|
if ENV['AMAZON_ACCESS_KEY_ID'] && ENV['AMAZON_SECRET_ACCESS_KEY']
|
13
|
-
@ec2 = EC2::Base.new(
|
13
|
+
@ec2 = EC2::Base.new(
|
14
14
|
:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
|
15
|
-
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
|
15
|
+
:secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
|
-
include EC2
|
19
|
+
include EC2
|
data/lib/EC2.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
# Amazon Web Services EC2 Query API Ruby library
|
3
3
|
#
|
4
4
|
# Ruby Gem Name:: amazon-ec2
|
5
|
-
# Author:: Glenn Rempe (mailto:
|
5
|
+
# Author:: Glenn Rempe (mailto:glenn@rempe.us)
|
6
6
|
# Copyright:: Copyright (c) 2007-2008 Glenn Rempe
|
7
7
|
# License:: Distributes under the same terms as Ruby
|
8
|
-
# Home:: http://amazon-ec2
|
8
|
+
# Home:: http://github.com/grempe/amazon-ec2/tree/master
|
9
9
|
#++
|
10
10
|
|
11
11
|
%w[ base64 cgi openssl digest/sha1 net/https rexml/document time ostruct ].each { |f| require f }
|
@@ -22,7 +22,7 @@ module EC2
|
|
22
22
|
DEFAULT_HOST = 'ec2.amazonaws.com'
|
23
23
|
|
24
24
|
# This is the version of the API as defined by Amazon Web Services
|
25
|
-
API_VERSION = '2008-
|
25
|
+
API_VERSION = '2008-05-05'
|
26
26
|
|
27
27
|
# Builds the canonical string for signing. This strips out all '&', '?', and '='
|
28
28
|
# from the query string to be signed.
|