Ey Info
Summary
Quickly set up your ~/.ssh/config shortcuts for your ey cloud servers.
Install
gem install --no-ri --no-rdoc ey_info # sudo if you need to
Usage Command Line
# will set up your ~/ssh/config shortcuts. $ ey_info -i "id_rsa" -u "root" # same as defaults $ ey_info # same as above
If you're environment in the ey cloud dashboard is called 'production' with an app_master, and 2 app instances.
$ ssh production_app_master vs $ ssh -i ~/.ssh/id-rsa root@ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com $ ssh production_app1 $ ssh production_app2 $ ssh production_db_master $ ssh production_db_slave1
Usage With Capistrano
I still find capistrano a very useful utility for debugging and still use wanted to use it with EY's cloud.
$ cap invoke COMMAND="..." is extremely useful. The engineyard gem provides a "ey ssh 'uptime' --all -e production" command but it loops through the servers one by one instead of running the commands in parallel, which can be slow if you have lots of servers.
You can use this gem to dynamically grab the ec2 hosts information from your ey environment and set up your capistrano roles.
Here are a few examples of how you can use it in your config/deploy.rb:
require 'ey_info' task :production do @info = EyInfo::Hosts.new hosts = @info.hosts("production") # parameter is the environment name in EY's gui interface role :db, hosts.find {|x| x[:role] == "app_master" }[:ssh_key], :primary => true # app instances hosts.select {|x| x[:role] =~ /app/ }.each do |h| role :web, h[:ssh_key] role :app, h[:ssh_key], :sphinx => true end # utility instances hosts.select {|x| x[:role] =~ /util/ }.each do |h| role :web, h[:ssh_key] role :app, h[:ssh_key], :sphinx => true end end