1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
Module for the 'fog' gem to support Amazon Web Services http://aws.amazon.com/
Find a file
Aaron Stone c422aa7501 Support Partial reservations by parsing an array of recurring charges
This is a semi-breaking change: the recurringCharges field is switching from a
Hash to an Array, however it never before contained any values because it was
unable to parse the AWS XML response. The likelihood of breaking anybody's
"working" code is rather low given that it never worked.

While the AWS API currently supports only a single type of recurring charge,
hourly, they've left the ability to have more/other recurring charge types in
the future, so we should reflect that in the parsed data structure as well.
2017-01-04 12:07:25 -08:00
gemfiles Add Gemfile-ruby-2.0 for Ruby 2.0 on Travis CI 2017-01-04 00:20:15 -08:00
lib/fog Support Partial reservations by parsing an array of recurring charges 2017-01-04 12:07:25 -08:00
tests Added support for attaching auto sclaing groups to target groups 2016-12-13 14:14:29 +01:00
.gitignore make pry-nav and mime-types available in Gemfile-edge 2016-03-01 08:12:41 -08:00
.travis.yml Add Gemfile-ruby-2.0 for Ruby 2.0 on Travis CI 2017-01-04 00:20:15 -08:00
CHANGELOG.md update CHANGELOG.md 2016-12-16 09:16:39 -08:00
CONTRIBUTING.md update OS bits 2015-01-12 10:38:23 -06:00
CONTRIBUTORS.md update OS bits 2015-01-12 10:38:23 -06:00
fog-aws.gemspec GitHub does no longer provide http:// pages 2016-08-02 04:34:17 +09:00
Gemfile Modify using Code Climate. 2016-11-22 12:06:32 +09:00
LICENSE.md update OS bits 2015-01-12 10:38:23 -06:00
Rakefile working tests 2015-01-02 09:42:20 -08:00
README.md Update README.md 2016-03-02 23:33:41 +04:00

Fog::Aws

Gem Version Build Status Dependency Status Test Coverage Code Climate

Installation

Add this line to your application's Gemfile:

gem 'fog-aws'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fog-aws

Usage

Before you can use fog-aws, you must require it in your application:

require '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:

default:
  aws_access_key_id:     <YOUR_ACCESS_KEY_ID>
  aws_secret_access_key: <YOUR_SECRET_ACCESS_KEY>

Connecting to EC2 service

ec2 = Fog::Compute.new :provider => 'AWS', :region => 'us-west-2'

You can review all the requests available with this service using #requests method:

ec2.requests # => [:allocate_address, :assign_private_ip_addresses, :associate_address, ...]

Launch an EC2 on-demand instance:

response = ec2.run_instances(
  "ami-23ebb513",
  1,
  1,
  "InstanceType"  => "t1.micro",
  "SecurityGroup" => "ssh",
  "KeyName"       => "miguel"
)
instance_id = response.body["instancesSet"].first["instanceId"] # => "i-02db5af4"
instance = ec2.servers.get(instance_id)
instance.wait_for { ready? }
puts instance.public_ip_address # => "356.300.501.20"

Terminate an EC2 instance:

instance = ec2.servers.get("i-02db5af4")
instance.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.

Contributing

  1. Fork it ( https://github.com/fog/fog-aws/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request