simnalamburt / eclair

Simple ssh tool for Amazon EC2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eclair RubyGems total downloads

A video showing how Eclair works

Simple ssh helper for Amazon EC2

curl -LO 'https://github.com/simnalamburt/eclair/releases/download/v3.0.3-patch.1/ecl-3.0.3.pre.patch.1.gem'
gem install ./ecl-3.0.3.pre.patch.1.gem
rm ./ecl-3.0.3.pre.patch.1.gem

Requirements

  • tmux > 2.0
  • Properly configured ~/.aws/credentials

Usage

$ ecl

First 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 = 4

ssh_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
end

group_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
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

ssh_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_address

ssh_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 = true

Example 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.3.gem

 


eclair is primarily distributed under the terms of the MIT License.

About

Simple ssh tool for Amazon EC2

License:MIT License


Languages

Language:Ruby 99.6%Language:Shell 0.4%