Simple ssh helper for Amazon EC2
gem install eclRequirements
- tmux > 2.0
- Properly configured
~/.aws/credentials
Usage
$ eclFirst execution will create ~/.ecl/config.rb file. Edit this file and run again.
Configurations
aws_region
AWS region to connect.
config.aws_region = "ap-northeast-1"columns
Max number of columns displayed in eclair.
config.columns = 4ssh_username
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
endgroup_by
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
endGrouping by instance name is also possible:
config.group_by = lambda do |instance|
case instance.name
when /^production/
"production servers"
when /^test/
"test servers"
end
endYou can disable grouping by assigning nil:
config.group_by = nilssh_ports
Port numbers to try ssh.
config.ssh_ports = [1234, 22]ssh_options
Extra options passed to ssh.
config.ssh_options = "-o ConnectTimeout=1 -o StrictHostKeyChecking=no"ssh_hostname
Hostname to use in ssh. Choose from :public_dns_name, :public_ip_address,
:private_dns_name, :private_ip_address
config.ssh_hostname = :public_ip_addressssh_keys
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",
}use_vpc_id_env (Experimental)
This Feature is experimental and subject to change in future versions
Boolean variable. If true use VPC_ID Environment variable for filtering EC2 instances.
config.use_vpc_id_env = trueExample VPC_ID variable:
VPC_ID=vpc-12345678901234567
Install from Source
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.4.gem
eclair is primarily distributed under the terms of the MIT License.
