amazon-ec2 0.2.10 → 0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- data/{History.txt → CHANGELOG} +7 -0
- data/{License.txt → LICENSE} +0 -0
- data/README.rdoc +322 -0
- data/Rakefile +30 -4
- data/bin/ec2-gem-example.rb +0 -3
- data/lib/EC2.rb +1 -8
- data/lib/EC2/instances.rb +3 -2
- metadata +20 -58
- data/Manifest.txt +0 -46
- data/README.txt +0 -154
- data/config/hoe.rb +0 -76
- data/config/requirements.rb +0 -17
- data/lib/EC2/version.rb +0 -18
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -74
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -27
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/test_EC2_version.rb +0 -44
- data/website/index.html +0 -566
- data/website/index.txt +0 -427
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.rhtml +0 -55
data/{History.txt → CHANGELOG}
RENAMED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 0.2.12 2008-04-25
|
2
|
+
* A few adjustments to work with GitHub.
|
3
|
+
|
4
|
+
=== 0.2.11 2008-04-25
|
5
|
+
* Moved gem completely to GitHub.
|
6
|
+
* Removed a LOT of RubyForge related cruft that's no longer needed.
|
7
|
+
|
1
8
|
=== 0.2.10 2008-04-13
|
2
9
|
* Fix bug where ec2#disassociate_address would return 'undefined method 'reject!' for "xxx.xxx.xxx.xxx":String'.
|
3
10
|
Thanks to Brian Thomas for reporting.
|
data/{License.txt → LICENSE}
RENAMED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,322 @@
|
|
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). The server resources in the cloud can be provisioned on demand by making 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 and control server resources on demand from your Ruby scripts, or from applications written in your Ruby framework of choice (Ruby on Rails, Merb, etc.).
|
8
|
+
|
9
|
+
For the most complete and up-to date README information please visit the project homepage at:
|
10
|
+
|
11
|
+
http://github.com/grempe/amazon-ec2/tree/master
|
12
|
+
|
13
|
+
or the EC2 website at http://aws.amazon.com/ec2
|
14
|
+
|
15
|
+
|
16
|
+
== Installation
|
17
|
+
|
18
|
+
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.
|
19
|
+
|
20
|
+
=== Get an AWS account
|
21
|
+
|
22
|
+
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!).
|
23
|
+
|
24
|
+
=== Install required gem pre-requisites
|
25
|
+
|
26
|
+
The following gems should be installed automatically as part of your install of amazon-ec2. Most of them are needed for testing build dependencies but they should be painless to install even if you don’t plan on running the tests or building this gem manually on your own.
|
27
|
+
|
28
|
+
XmlSimple (required)
|
29
|
+
Mocha (optional for testing)
|
30
|
+
Rcov (optional for testing)
|
31
|
+
Test-Spec (optional for testing)
|
32
|
+
|
33
|
+
=== Install the amazon-ec2 gem
|
34
|
+
|
35
|
+
# ONE TIME ONLY
|
36
|
+
# Execute this on each machine where you install gems to add GitHub as a gem source
|
37
|
+
# Do this only once or you'll end up with multiple entries in 'gem sources'
|
38
|
+
gem sources -a http://gems.github.com/
|
39
|
+
|
40
|
+
# ONE TIME ONLY
|
41
|
+
# Only if you had a previous version of the gem installed from RubyForge before we moved to GitHub
|
42
|
+
# Say 'Y' to remove all previous versions and all binaries when prompted. It won't hurt to do
|
43
|
+
# this in any case.
|
44
|
+
sudo gem uninstall amazon-ec2
|
45
|
+
|
46
|
+
# Finally install the gem
|
47
|
+
sudo gem install grempe-amazon-ec2
|
48
|
+
|
49
|
+
== Using amazon-ec2
|
50
|
+
|
51
|
+
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.
|
52
|
+
|
53
|
+
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.
|
54
|
+
|
55
|
+
|
56
|
+
=== Setting up
|
57
|
+
|
58
|
+
The 'ec2sh' and 'ec2-gem-example.rb' scripts which will be introduced to you shortly expect your AWS EC2 credentials to be stored as shell environment variables which are accessible to those scripts. This makes them convenient to use whenever you need to do a quick query to see what images you have available to you, what's running now, or to start or stop an instance on EC2. You’ll find 'ec2sh' to be a very handy tool. I’ll describe only the OS X route for setting up (of course the setup steps will vary depending on your particular system and preferred shell). If you don’t want to do it this way, feel free to copy these scripts from the gem dir to any location where you can run them from and modify them directly to include your credentials.
|
59
|
+
|
60
|
+
Edit the file ~/.bash_login and add the following to the existing contents:
|
61
|
+
|
62
|
+
export RUBYOPT="rubygems"
|
63
|
+
|
64
|
+
# For amazon-ec2 and amazon s3 ruby gems
|
65
|
+
export AMAZON_ACCESS_KEY_ID="YOUR_ACCESS_KEY_ID"
|
66
|
+
export AMAZON_SECRET_ACCESS_KEY="YOUR_SECRET_ACCESS_KEY_ID"
|
67
|
+
|
68
|
+
Once you save the file you should close and re-open your terminal so the new variables are made available. You’ll need to do this close/re-open step for each terminal window you have open (or issue the ‘source ~/.bash_login’ command in each). Make sure that this file is only readable by your user so you don’t inadvertently expose your credentials to other users on your system.
|
69
|
+
|
70
|
+
You can verify that this setup is complete by running the ‘set’ in a command window and seeing that your credentials are in the list of shell variables.
|
71
|
+
|
72
|
+
=== The basics
|
73
|
+
|
74
|
+
The library exposes one main interface module
|
75
|
+
|
76
|
+
EC2::Base
|
77
|
+
|
78
|
+
This method requires arguments which include your AWS credentials and it will return an object that you can use to make method calls directly against EC2. All the operations for using the EC2 service, including query string header signing, are handled automatically for you. The connection string will look something like this:
|
79
|
+
|
80
|
+
@ec2 = EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
|
81
|
+
|
82
|
+
I've tried to keep the public methods on 'amazon-ec2' as close as possible to the AWS EC2 Query API. This similarity allows you to reference the Query API Reference in the EC2 Developer Guide and be able to get started right away. In most cases the methods names only differ in how they are presented. e.g. 'DescribeImages' becomes '#describe_images()' in Ruby. Feel free to browse the full RDoc documentation for all classes and methods of 'amazon-ec2' if you want more details.
|
83
|
+
|
84
|
+
|
85
|
+
=== Examples
|
86
|
+
|
87
|
+
The best way to become familiar with 'amazon-ec2' is to take it for a test drive. We have provided a few simple ways to get you started. There is also some sample code below that should help out in using 'amazon-ec2' with a plain Ruby script, or as part of a Ruby on Rails application.
|
88
|
+
|
89
|
+
==== Using the 'ec2-gem-example.rb' sample test script
|
90
|
+
|
91
|
+
An example Ruby script which exercises the library a bit more is installed for you to check out when you install this gem. You can run this script to verify that everything is setup and working correctly in your environment. Consult the file which is installed at :
|
92
|
+
|
93
|
+
[your amazon-ec2 gem dir]/examples/ec2-example.rb
|
94
|
+
|
95
|
+
Since we also package this sample file in the gem’s bin/ dir you should also be able to run it from anywhere on your shell path (once you have set your environment variables as described above).
|
96
|
+
|
97
|
+
==== Using the 'ec2sh' command shell
|
98
|
+
|
99
|
+
The 'ec2sh' command shell is actually a standard 'irb' Ruby shell, with the main difference being we read your AWS credentials from your environment and pre-configure a connection string for you. This lets you run any EC2 command very simply. This has proven to be a valuable tool during the development of this gem and you should try it out. Since we install this tool in your system path as part of the installation of this gem, you should be able to simply run 'ec2sh' from any terminal command prompt on your local system. You’ll see some basic instructions for use, and a few examples when you start 'ec2sh'. Go ahead and try it out now. We’ll wait...
|
100
|
+
|
101
|
+
If you're not in front of a terminal shell now (perhaps you’re browsing this site on your iPhone) this is what you would see:
|
102
|
+
|
103
|
+
|
104
|
+
hostname:/tmp/rails/amazon_test glenn$ ec2sh
|
105
|
+
|
106
|
+
'ec2sh' usage :
|
107
|
+
This is an interactive 'irb' command shell that allows you to use all
|
108
|
+
commands available to the amazon-ec2 gem. You'll find this to be a
|
109
|
+
great tool to help you debug issues and practice running commands
|
110
|
+
against the live EC2 servers prior to putting them in your code.
|
111
|
+
|
112
|
+
The EC2 connection is wired to the class instance '@ec2'. Make method calls
|
113
|
+
on this to execute commands on EC2. Adding a #to_s
|
114
|
+
at the end of any command should give you a full String representation of the
|
115
|
+
response. The #xml data is available for each response
|
116
|
+
which allows you to view the full and complete XML response returned by
|
117
|
+
EC2 without any parsing applied. This is useful for viewing the
|
118
|
+
hierarchy of an entire response in a friendly way (if XML is friendly
|
119
|
+
to you!). Understanding the hierarchy of the XML response is critical
|
120
|
+
to making effective use of this library.
|
121
|
+
|
122
|
+
Examples to try:
|
123
|
+
|
124
|
+
returns : all ec2 public methods
|
125
|
+
>> @ec2.methods.sort
|
126
|
+
|
127
|
+
returns : a string representation of ALL images
|
128
|
+
>> @ec2.describe_images.to_s
|
129
|
+
|
130
|
+
returns : an Array of EC2::Response objects, each an EC2 image and its data
|
131
|
+
>> @ec2.describe_images.imagesSet.item
|
132
|
+
>> @ec2.describe_images.imagesSet.item[0] (an OpenStruct of a single item in that array)
|
133
|
+
>> @ec2.describe_images.imagesSet.item[0].to_s (a String representation of that OpenStruct item)
|
134
|
+
|
135
|
+
returns : an XML representation of all images
|
136
|
+
>> puts @ec2.describe_images.xml
|
137
|
+
|
138
|
+
returns : an XML representation of all images owned by Amazon
|
139
|
+
>> puts @ec2.describe_images(:owner_id => 'amazon').xml
|
140
|
+
|
141
|
+
>> @ec2.describe_images.imagesSet.item[0].to_s
|
142
|
+
=> "#<EC2::Response:0x100A465B4 imageId=\"ami-018e6b68\" imageLocation=\"rbuilder-online/phonehome-1.5.6-x86_10132.img.manifest.xml\" imageOwnerId=\"099034111737\" imageState=\"available\" isPublic=\"true\" parent=#<EC2::Response:0x100A469A6 ...>>"
|
143
|
+
|
144
|
+
|
145
|
+
=== Ruby script usage example:
|
146
|
+
|
147
|
+
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
|
+
|
149
|
+
#!/usr/bin/env ruby
|
150
|
+
|
151
|
+
require 'rubygems'
|
152
|
+
require 'ec2'
|
153
|
+
|
154
|
+
ACCESS_KEY_ID = '--YOUR AWS ACCESS KEY ID--'
|
155
|
+
SECRET_ACCESS_KEY = '--YOUR AWS SECRET ACCESS KEY--'
|
156
|
+
|
157
|
+
ec2 = EC2::Base.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY)
|
158
|
+
|
159
|
+
puts "----- listing images owned by 'amazon' -----"
|
160
|
+
ec2.describe_images(:owner_id => "amazon").imagesSet.item.each do |image|
|
161
|
+
# OpenStruct objects have members!
|
162
|
+
image.members.each do |member|
|
163
|
+
puts "#{member} => #{image[member]}"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
=== Ruby on Rails usage example:
|
168
|
+
|
169
|
+
<b>config/environment.rb</b>
|
170
|
+
|
171
|
+
# Require the amazon-ec2 gem and make its methods available in your Rails app
|
172
|
+
# Put this at the bottom of your environment.rb
|
173
|
+
require 'EC2'
|
174
|
+
|
175
|
+
<b>app/controllers/my_controller.rb</b>
|
176
|
+
|
177
|
+
[some controller code ...]
|
178
|
+
|
179
|
+
ec2 = EC2::Base.new(:access_key_id => "YOUR_AWS_ACCESS_KEY_ID", :secret_access_key => "YOUR_AWS_SECRET_ACCESS_KEY")
|
180
|
+
|
181
|
+
# get ALL public images
|
182
|
+
@ec2_images = ec2.describe_images().imagesSet.item
|
183
|
+
|
184
|
+
# Get info on all public EC2 images created by the Amazon EC2 team.
|
185
|
+
@ec2_images_amazon = ec2.describe_images(:owner_id => "amazon").imagesSet.item
|
186
|
+
|
187
|
+
[some more controller code ...]
|
188
|
+
|
189
|
+
|
190
|
+
<b>app/views/my/index.rhtml</b>
|
191
|
+
|
192
|
+
<h1>EC2 Test#index</h1>
|
193
|
+
|
194
|
+
<h1>Sample 1 - debug() view</h1>
|
195
|
+
|
196
|
+
<%= debug(@ec2_images_amazon) %>
|
197
|
+
|
198
|
+
<h1>Sample 2 - Build a table</h1>
|
199
|
+
|
200
|
+
<table border='1'>
|
201
|
+
<tr>
|
202
|
+
<th>image.imageId</th>
|
203
|
+
<th>image.imageLocation</th>
|
204
|
+
<th>image.imageOwnerId</th>
|
205
|
+
<th>image.imageState</th>
|
206
|
+
<th>image.isPublic</th>
|
207
|
+
</tr>
|
208
|
+
|
209
|
+
<% for image in @ec2_images_amazon %>
|
210
|
+
<tr>
|
211
|
+
<td><%=h image.imageId %></td>
|
212
|
+
<td><%=h image.imageLocation %></td>
|
213
|
+
<td><%=h image.imageOwnerId %></td>
|
214
|
+
<td><%=h image.imageState %></td>
|
215
|
+
<td><%=h image.isPublic %></td>
|
216
|
+
</tr>
|
217
|
+
<% end %>
|
218
|
+
</table>
|
219
|
+
|
220
|
+
<h1>Sample 3 - Iterate</h1>
|
221
|
+
|
222
|
+
<% @ec2_images_amazon.each do |image| %>
|
223
|
+
<% image.each_pair do |key, value| %>
|
224
|
+
<% unless key == 'parent' %>
|
225
|
+
<%= "#{key} => #{value}" %><br />
|
226
|
+
<% end %>
|
227
|
+
<% end %>
|
228
|
+
<br />
|
229
|
+
<% end %>
|
230
|
+
|
231
|
+
|
232
|
+
=== Important notes regarding the structure of EC2::Response Objects
|
233
|
+
|
234
|
+
One of the key benefits of this new version of the library is that all responses from EC2 are bundled up in a real data structure and no longer require parsing of text. EC2::Response inherits from the OpenStruct class and we populate it directly from the XML given to us by EC2 in response to any command we issue. This means that future changes to the API and what is returned by EC2 will largely be handled transparently by the gem. This is a huge benefit. What this means though, is that you may have to do a little homework on what actually gets returned by EC2 as XML. For example, when you make a #describe_images call in 'ec2sh' what you will get back will look like:
|
235
|
+
|
236
|
+
$ ec2sh
|
237
|
+
>> puts @ec2.describe_images(:owner_id => 'amazon').xml
|
238
|
+
|
239
|
+
<?xml version="1.0"?>
|
240
|
+
<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2007-01-19/">
|
241
|
+
<imagesSet>
|
242
|
+
<item>
|
243
|
+
<imageId>ami-20b65349</imageId>
|
244
|
+
<imageLocation>ec2-public-images/fedora-core4-base.manifest.xml</imageLocation>
|
245
|
+
<imageState>available</imageState>
|
246
|
+
<imageOwnerId>amazon</imageOwnerId>
|
247
|
+
<isPublic>true</isPublic>
|
248
|
+
</item>
|
249
|
+
<item>
|
250
|
+
<imageId>ami-22b6534b</imageId>
|
251
|
+
<imageLocation>ec2-public-images/fedora-core4-mysql.manifest.xml</imageLocation>
|
252
|
+
<imageState>available</imageState>
|
253
|
+
<imageOwnerId>amazon</imageOwnerId>
|
254
|
+
<isPublic>true</isPublic>
|
255
|
+
</item>
|
256
|
+
<item>
|
257
|
+
<imageId>ami-23b6534a</imageId>
|
258
|
+
<imageLocation>ec2-public-images/fedora-core4-apache.manifest.xml</imageLocation>
|
259
|
+
<imageState>available</imageState>
|
260
|
+
<imageOwnerId>amazon</imageOwnerId>
|
261
|
+
<isPublic>true</isPublic>
|
262
|
+
</item>
|
263
|
+
<item>
|
264
|
+
<imageId>ami-25b6534c</imageId>
|
265
|
+
<imageLocation>ec2-public-images/fedora-core4-apache-mysql.manifest.xml</imageLocation>
|
266
|
+
<imageState>available</imageState>
|
267
|
+
<imageOwnerId>amazon</imageOwnerId>
|
268
|
+
<isPublic>true</isPublic>
|
269
|
+
</item>
|
270
|
+
<item>
|
271
|
+
<imageId>ami-26b6534f</imageId>
|
272
|
+
<imageLocation>ec2-public-images/developer-image.manifest.xml</imageLocation>
|
273
|
+
<imageState>available</imageState>
|
274
|
+
<imageOwnerId>amazon</imageOwnerId>
|
275
|
+
<isPublic>true</isPublic>
|
276
|
+
</item>
|
277
|
+
<item>
|
278
|
+
<imageId>ami-2bb65342</imageId>
|
279
|
+
<imageLocation>ec2-public-images/getting-started.manifest.xml</imageLocation>
|
280
|
+
<imageState>available</imageState>
|
281
|
+
<imageOwnerId>amazon</imageOwnerId>
|
282
|
+
<isPublic>true</isPublic>
|
283
|
+
</item>
|
284
|
+
</imagesSet>
|
285
|
+
</DescribeImagesResponse>
|
286
|
+
|
287
|
+
You can see in the XML the structure that you will need to follow when constructing queries for information and parsing responses from EC2.
|
288
|
+
|
289
|
+
So, for example, if you wanted to get the image ID of the third image listed in the response above you would need to do:
|
290
|
+
|
291
|
+
>> puts @ec2.describe_images(:owner_id => 'amazon').imagesSet.item[2].imageId
|
292
|
+
ami-23b6534a
|
293
|
+
|
294
|
+
EC2 will typically return sets of things (imagesSet, reservationSet, etc.) which we map to ruby Arrays (.imagesSet.item in the example above). If you want to iterate over a response set you will need to iterate over this array. The Arrays will typically contain additional EC2::Response objects that represent each individual item. You’ll find that you can use the 'ec2sh' to help you understand the structure more completely if you try issuing commands there as a way to practice seeing what will be returned and making sure you get exactly what you want. You can always call the EC2::Response#xml method like I did above to see the exact XML returned which allows you to easily derive the structure for the Ruby OpenStruct object.
|
295
|
+
|
296
|
+
|
297
|
+
== Additional Resources
|
298
|
+
|
299
|
+
=== Project Websites
|
300
|
+
|
301
|
+
* Project Home : http://github.com/grempe/amazon-ec2/tree/master
|
302
|
+
* Discussion Group : http://groups.google.com/group/amazon-ec2
|
303
|
+
* Report Bugs / Request Features : http://grempe.lighthouseapp.com/projects/10644-amazon-ec2/overview
|
304
|
+
* Amazon Web Services : http://aws.amazon.com
|
305
|
+
|
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
|
+
== Credits
|
313
|
+
|
314
|
+
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
|
+
|
316
|
+
== Contact
|
317
|
+
|
318
|
+
Comments, patches, Git pull requests and bug reports are welcome. Send an email to mailto:glenn.rempe@nospam@gmail.com or use the Google Groups forum for this project.
|
319
|
+
|
320
|
+
Enjoy!
|
321
|
+
|
322
|
+
Glenn Rempe
|
data/Rakefile
CHANGED
@@ -1,4 +1,30 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
|
6
|
+
# read the contents of the gemspec, eval it, and assign it to 'spec'
|
7
|
+
# this lets us maintain all gemspec info in one place. Nice and DRY.
|
8
|
+
spec = eval(IO.read("amazon-ec2.gemspec"))
|
9
|
+
|
10
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
11
|
+
pkg.gem_spec = spec
|
12
|
+
end
|
13
|
+
|
14
|
+
task :install => [:package] do
|
15
|
+
sh %{sudo gem install pkg/#{GEM}-#{VERSION}}
|
16
|
+
end
|
17
|
+
|
18
|
+
Rake::TestTask.new do |t|
|
19
|
+
t.libs << "test"
|
20
|
+
t.test_files = FileList['test/test*.rb']
|
21
|
+
t.verbose = true
|
22
|
+
end
|
23
|
+
|
24
|
+
Rake::RDocTask.new do |rd|
|
25
|
+
rd.main = "README.rdoc"
|
26
|
+
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
27
|
+
rd.rdoc_dir = 'doc'
|
28
|
+
rd.options = spec.rdoc_options
|
29
|
+
end
|
30
|
+
|
data/bin/ec2-gem-example.rb
CHANGED
data/lib/EC2.rb
CHANGED
@@ -24,13 +24,6 @@ module EC2
|
|
24
24
|
# This is the version of the API as defined by Amazon Web Services
|
25
25
|
API_VERSION = '2008-02-01'
|
26
26
|
|
27
|
-
# This release version is passed in with each request as part
|
28
|
-
# of the HTTP 'User-Agent' header. Set this be the same value
|
29
|
-
# as what is stored in the lib/EC2/version.rb module constant instead.
|
30
|
-
# This way we keep it nice and DRY and only have to define the
|
31
|
-
# version number in a single place.
|
32
|
-
RELEASE_VERSION = EC2::VERSION::STRING
|
33
|
-
|
34
27
|
# Builds the canonical string for signing. This strips out all '&', '?', and '='
|
35
28
|
# from the query string to be signed.
|
36
29
|
# Note: The parameters in the path passed in must already be sorted in
|
@@ -174,7 +167,7 @@ module EC2
|
|
174
167
|
|
175
168
|
req = Net::HTTP::Post.new("/")
|
176
169
|
req.content_type = 'application/x-www-form-urlencoded'
|
177
|
-
req['User-Agent'] = "
|
170
|
+
req['User-Agent'] = "github-amazon-ec2-ruby-gem"
|
178
171
|
|
179
172
|
response = @http.request(req, query)
|
180
173
|
|
data/lib/EC2/instances.rb
CHANGED
@@ -28,7 +28,8 @@ module EC2
|
|
28
28
|
# launch, the instances start in the default security group.
|
29
29
|
#
|
30
30
|
# An optional instance type can be specified. Currently supported types are 'm1.small', 'm1.large',
|
31
|
-
# and '
|
31
|
+
# 'm1.xlarge' and the high CPU types 'c1.medium' and 'c1.xlarge'. 'm1.small' is the default
|
32
|
+
# if no instance_type is specified.
|
32
33
|
#
|
33
34
|
# You can provide an optional key pair ID for each image in the launch request. All instances
|
34
35
|
# that are created from images that use this key pair will have access to the associated public
|
@@ -82,7 +83,7 @@ module EC2
|
|
82
83
|
raise ArgumentError, ":min_count is not valid" unless options[:min_count].to_i > 0
|
83
84
|
raise ArgumentError, ":max_count is not valid" unless options[:max_count].to_i > 0
|
84
85
|
raise ArgumentError, ":addressing_type must be 'direct' or 'public'" unless options[:addressing_type] == "public" || options[:addressing_type] == "direct"
|
85
|
-
raise ArgumentError, ":instance_type must be 'm1.small', 'm1.large' or '
|
86
|
+
raise ArgumentError, ":instance_type must be 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', or 'c1.xlarge'" unless options[:instance_type] == "m1.small" || options[:instance_type] == "m1.large" || options[:instance_type] == "m1.xlarge" || options[:instance_type] == "c1.medium" || options[:instance_type] == "c1.xlarge"
|
86
87
|
raise ArgumentError, ":base64_encoded must be 'true' or 'false'" unless options[:base64_encoded] == true || options[:base64_encoded] == false
|
87
88
|
|
88
89
|
# If :user_data is passed in then URL escape and Base64 encode it
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Glenn Rempe
|
@@ -9,7 +9,7 @@ autorequire: EC2
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-03 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: "0"
|
23
23
|
version:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: mocha
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ">="
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 0
|
31
|
+
version: "0"
|
32
32
|
version:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: test-spec
|
@@ -37,7 +37,7 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0
|
40
|
+
version: "0"
|
41
41
|
version:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rcov
|
@@ -46,28 +46,10 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0
|
49
|
+
version: "0"
|
50
50
|
version:
|
51
|
-
|
52
|
-
|
53
|
-
version_requirement:
|
54
|
-
version_requirements: !ruby/object:Gem::Requirement
|
55
|
-
requirements:
|
56
|
-
- - ">="
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: 1.0.0
|
59
|
-
version:
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: RedCloth
|
62
|
-
version_requirement:
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 3.0.4
|
68
|
-
version:
|
69
|
-
description: An interface library that allows Ruby or Ruby on Rails applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate server instances.
|
70
|
-
email: grempe@rubyforge.org
|
51
|
+
description: An interface library that allows Ruby applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate cloud servers.
|
52
|
+
email: glenn.rempe@gmail.com
|
71
53
|
executables:
|
72
54
|
- ec2-gem-example.rb
|
73
55
|
- ec2sh
|
@@ -75,21 +57,15 @@ executables:
|
|
75
57
|
extensions: []
|
76
58
|
|
77
59
|
extra_rdoc_files:
|
78
|
-
- README.
|
79
|
-
-
|
80
|
-
-
|
60
|
+
- README.rdoc
|
61
|
+
- CHANGELOG
|
62
|
+
- LICENSE
|
81
63
|
files:
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
85
|
-
- README.txt
|
64
|
+
- README.rdoc
|
65
|
+
- LICENSE
|
66
|
+
- CHANGELOG
|
86
67
|
- Rakefile
|
87
|
-
-
|
88
|
-
- bin/ec2sh
|
89
|
-
- bin/setup.rb
|
90
|
-
- config/hoe.rb
|
91
|
-
- config/requirements.rb
|
92
|
-
- lib/EC2.rb
|
68
|
+
- lib/EC2
|
93
69
|
- lib/EC2/console.rb
|
94
70
|
- lib/EC2/elastic_ips.rb
|
95
71
|
- lib/EC2/exceptions.rb
|
@@ -100,14 +76,7 @@ files:
|
|
100
76
|
- lib/EC2/products.rb
|
101
77
|
- lib/EC2/responses.rb
|
102
78
|
- lib/EC2/security_groups.rb
|
103
|
-
- lib/EC2
|
104
|
-
- script/destroy
|
105
|
-
- script/generate
|
106
|
-
- script/txt2html
|
107
|
-
- setup.rb
|
108
|
-
- tasks/deployment.rake
|
109
|
-
- tasks/environment.rake
|
110
|
-
- tasks/website.rake
|
79
|
+
- lib/EC2.rb
|
111
80
|
- test/test_EC2.rb
|
112
81
|
- test/test_EC2_console.rb
|
113
82
|
- test/test_EC2_elastic_ips.rb
|
@@ -118,15 +87,9 @@ files:
|
|
118
87
|
- test/test_EC2_products.rb
|
119
88
|
- test/test_EC2_responses.rb
|
120
89
|
- test/test_EC2_security_groups.rb
|
121
|
-
- test/test_EC2_version.rb
|
122
90
|
- test/test_helper.rb
|
123
|
-
- website/index.html
|
124
|
-
- website/index.txt
|
125
|
-
- website/javascripts/rounded_corners_lite.inc.js
|
126
|
-
- website/stylesheets/screen.css
|
127
|
-
- website/template.rhtml
|
128
91
|
has_rdoc: true
|
129
|
-
homepage: http://amazon-ec2
|
92
|
+
homepage: http://github.com/grempe/amazon-ec2/
|
130
93
|
post_install_message:
|
131
94
|
rdoc_options:
|
132
95
|
- --quiet
|
@@ -136,7 +99,7 @@ rdoc_options:
|
|
136
99
|
- index.html
|
137
100
|
- --line-numbers
|
138
101
|
- --main
|
139
|
-
- README.
|
102
|
+
- README.rdoc
|
140
103
|
- --inline-source
|
141
104
|
require_paths:
|
142
105
|
- lib
|
@@ -154,11 +117,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
117
|
version:
|
155
118
|
requirements: []
|
156
119
|
|
157
|
-
rubyforge_project:
|
120
|
+
rubyforge_project:
|
158
121
|
rubygems_version: 1.1.1
|
159
122
|
signing_key:
|
160
123
|
specification_version: 2
|
161
|
-
summary: An interface library that allows Ruby
|
124
|
+
summary: An interface library that allows Ruby applications to easily connect to the HTTP 'Query API' for the Amazon Web Services Elastic Compute Cloud (EC2) and manipulate cloud servers.
|
162
125
|
test_files:
|
163
126
|
- test/test_EC2.rb
|
164
127
|
- test/test_EC2_console.rb
|
@@ -170,5 +133,4 @@ test_files:
|
|
170
133
|
- test/test_EC2_products.rb
|
171
134
|
- test/test_EC2_responses.rb
|
172
135
|
- test/test_EC2_security_groups.rb
|
173
|
-
- test/test_EC2_version.rb
|
174
136
|
- test/test_helper.rb
|