ec2_tools

Ec2Tools is a Ruby library for Amazon EC2

Getting started

write config file in config/amazon_ec2.yml or .account.yml

key: YOUR_ACCESS_KEY_ID
secret: YOUR_SECRET_ACCESS_KEY
server: YOUR_EC2_REGION

and create instance

Ec2Tools.new

OR specify config file when create instance

Ec2Tools.new('config.yml')

Usage

This gem is useful for the case like this

in config/deploy.rb,

old

role :db, 'ec2-111-111-111-111.amazonaws.com'
role :web, 'ec2-111-111-111-111.amazonaws.com', 'ec2-111-111-111-112.amazonaws.com', 'ec2-111-111-111-113.amazonaws.com', 'ec2-111-111-111-114.amazonaws.com',  ....

new

Ec2Tools.new.servers[:web].map(&:dnsName).each_with_index do |host, idx|
  role :db, host, :primary => true if idx == 0
  role :app, host
  role :web, host
end

You don’t need to do maintenance deploy.rb any longer!

Contributing to ec2_tools

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Yamada Masaki. See LICENSE.txt for further details.