Name: fog-aws
Owner: Crashlytics, Inc.
Description: Module for the 'fog' gem to support Amazon Web Services http://aws.amazon.com/
Created: 2015-05-05 23:47:14.0
Updated: 2015-05-06 16:11:36.0
Pushed: 2015-05-06 16:11:38.0
Size: 15083
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Add this line to your application's Gemfile:
'fog-aws'
And then execute:
$ bundle
Or install it yourself as:
$ gem install fog-aws
Before you can use fog-aws, you must require it in your application:
ire 'fog/aws'
Since it's a bad practice to have your credentials in source code, you should load them from default fog configuration file: `~/.fog
`. This file could look like this:
ult:
s_access_key_id: <YOUR_ACCESS_KEY_ID>
s_secret_access_key: <YOUR_SECRET_ACCESS_KEY>
= Fog::Compute.new :provider => 'AWS', :region => 'us-west-2'
You can review all the requests available with this service using `#requests
` method:
requests # => [:allocate_address, :assign_private_ip_addresses, :associate_address, ...]
onse = ec2.run_instances(
mi-23ebb513",
nstanceType" => "t1.micro",
ecurityGroup" => "ssh",
eyName" => "miguel"
ance_id = response.body["instancesSet"].first["instanceId"] # => "i-02db5af4"
ance = ec2.servers.get(instance_id)
ance.wait_for { ready? }
instance.public_ip_address # => "356.300.501.20"
ance = ec2.servers.get("i-02db5af4")
ance.destroy
Fog::AWS is more than EC2 since it supports many services provided by AWS. The best way to learn and to know about how many services are supported is to take a look at the source code. To review the tests directory and to play with the library in `irb
` can be very helpful resources as well.
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)