Simple ssh helper for Amazon EC2
gem install ecl
- tmux > 2.0
- Properly configured
~/.aws/credentials
$ ecl
First execution will create ~/.ecl/config.rb
file. Edit this file and run again.
AWS region to connect.
config.aws_region = "ap-northeast-1"
Max number of columns displayed in eclair.
config.columns = 4
Function to find username from image. Returns username of given image. Uses image data from EC2::Client#describe_images API call.
config.ssh_username = lambda do |image|
case image.name
when /ubuntu/
"ubuntu"
else
"ec2-user"
end
end
Function to find group name from instance. Returns group name from instance data. Uses instance data from EC2::Client#describe_instances API call.
You can group instances by security groups with this config:
config.group_by = lambda do |instance|
if instance.security_groups.first
instance.security_groups.first.group_name
else
"no_group"
end
end
Grouping by instance name is also possible:
config.group_by = lambda do |instance|
case instance.name
when /^production/
"production servers"
when /^test/
"test servers"
end
end
You can disable grouping by assigning nil:
config.group_by = nil
Port numbers to try ssh.
config.ssh_ports = [1234, 22]
Extra options passed to ssh.
config.ssh_options = "-o ConnectTimeout=1 -o StrictHostKeyChecking=no"
Hostname to use in ssh. Choose from :public_dns_name
, :public_ip_address
,
:private_dns_name
, :private_ip_address
config.ssh_hostname = :public_ip_address
Hash of EC2 keypair name => key_path in local. If your key has been already registered in ssh-agent, you don't have to configure this.
config.ssh_keys = {
"keypair1" => "/path/to/key1",
"keypair2" => "/path/to/key2",
}
If you want to use the latest functionalities, install Eclair from the source.
# Headers of ncursesw is required to build Eclair in GNU/Linux
sudo apt-get install libncursesw5-dev # Debian, Ubuntu, etc
sudo yum install libncursesw5-devel # CentOS, etc
# Build latest eclair gem
gem build eclair.gemspec
# Install eclair into your system
gem install ecl-3.0.1.gem
eclair is primarily distributed under the terms of the MIT License.