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

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