grempe-amazon-ec2 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. metadata +3 -3
  2. data/README.txt +0 -154
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grempe-amazon-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glenn Rempe
@@ -75,14 +75,14 @@ executables:
75
75
  extensions: []
76
76
 
77
77
  extra_rdoc_files:
78
- - README.txt
78
+ - README.rdoc
79
79
  - History.txt
80
80
  - License.txt
81
81
  files:
82
82
  - History.txt
83
83
  - License.txt
84
84
  - Manifest.txt
85
- - README.txt
85
+ - README.rdoc
86
86
  - Rakefile
87
87
  - bin/ec2-gem-example.rb
88
88
  - bin/ec2sh
data/README.txt DELETED
@@ -1,154 +0,0 @@
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