Code Monkey home page Code Monkey logo

eclair's Introduction

eclair RubyGems total downloads

A video showing how Eclair works

Simple ssh helper for Amazon EC2

gem install ecl

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.4.gem

 


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

eclair's People

Contributors

geripgeri avatar hodduc avatar seonghyeok-moon avatar serialx avatar simnalamburt avatar synthdnb avatar wflyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eclair's Issues

Package eclair

Eclair is awesome and more people should be able to easily receive grace of it. To do so, we need to package this and (maybe) automate the release process.

TODOs

AWS SDK Version Flexibility

It's unncessary to have the version fixed like this. The SDK itself recomments this:

gem 'aws-sdk', '~> 2'

Add a debug option

If unexpected error happens inside particular parts of eclair (i.e. config.group_by), eclair quietly crashes without stacktraces. It'd be better if users are allowed to see those traces via a debug option.

Let's commit 'Gemfile.lock'

Since eclair is rather a terminal utility than a library, I think we should commit and push the Gemfile.lock to benefit some build reproducability.

`--version` not working: private method `select' called for nil:NilClass (NoMethodError)

$ ecl --version
/Users/seonghyeok/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/ecl-3.0.4/lib/eclair/grid.rb:33:in `initialize': private method `select' called for nil:NilClass (NoMethodError)

      at(*@cursor).select(true)
                  ^^^^^^^
	from /Users/seonghyeok/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/ecl-3.0.4/exe/ecl:21:in `new'
	from /Users/seonghyeok/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/ecl-3.0.4/exe/ecl:21:in `<top (required)>'
	from /Users/seonghyeok/.asdf/installs/ruby/3.2.2/bin/ecl:25:in `load'
	from /Users/seonghyeok/.asdf/installs/ruby/3.2.2/bin/ecl:25:in `<main>'

Other functions look fine

Allow per project config

Although there's an environment variable, it would be nice if the tool checks for the variable, then ./.ecl/config.rb, and finally ~/.ecl/config.rb.

Any better way to list up instances?

Hi,

In my case, It checks 220 instances to list up. Each time I run it, it takes several minutes to see the list of instances. It's really taking a lot of time to look up many instances. Are there any improvement plans or user tuning to improve performance?

Deprecate 'config.aws_region' option and add 'config.default_aws_region' option.

config.aws_region overrides AWS_REGION environment variable, and changing config variables in ~/.ecl/config.rb is not ergonomically convenient. So many users just comment out the config.aws_region variable and use the use the AWS_REGION.

So let's add new configuration option named config.default_aws_region which does not overrides AWS_REGION environment variable, and deprecate config.aws_region option.

TODOs

  • Remove config.aws_region option from documentation and eclare config template.
  • Print a warning to the STDERR when config.aws_region variable is set by the user.
  • Implement new config.default_aws_region option and mention it on docs and config template file.

How do you think?

(Blocked by #9)

aws multiple profile 사용 옵션 기능 요청

안녕하세요.
eclair를 오픈소스로 공개해주신 덕분에 잘 사용하고 있습니다.

한가지 기능을 요청드리고 싶은데요.
최근에 저희가 AWS를 Live와 Dev 용도로 계정을 분리해서 사용하면서 계속 설정을 변경해줘야 하는 불편이 생겼습니다.

$ ecl --profile live

그래서 위와 같이 옵션을 주는 경우, ~/.aws/config와 ~/.aws/credentials의 정보를 사용하면 어떨까요?

감사합니다.

`render_header': undefined method `header' for nil:NilClass (NoMethodError)

On Ubuntu 19.04, having done gem install ecl I get the following error running ecl a second time (after the config file has been created)

Traceback (most recent call last):
	6: from /home/justin/.rbenv/versions/2.5.0/bin/ecl:23:in `<main>'
	5: from /home/justin/.rbenv/versions/2.5.0/bin/ecl:23:in `load'
	4: from /home/justin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ecl-1.2.1/exe/ecl:4:in `<top (required)>'
	3: from /home/justin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ecl-1.2.1/lib/eclair/console.rb:16:in `init'
	2: from /home/justin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ecl-1.2.1/lib/eclair/grid.rb:60:in `start'
	1: from /home/justin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ecl-1.2.1/lib/eclair/grid.rb:108:in `render_all'
/home/justin/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ecl-1.2.1/lib/eclair/grid.rb:23:in `render_header': undefined method `header' for nil:NilClass (NoMethodError)

ruby version:

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Fix undefined method 'exists?' for File:Class (NoMethodError) in ruby 3.2.0

Since File.exists? has been deprecated and removed in ruby 3.2.0, running scaffold command outputs this error message:

.../ecl-3.0.3/lib/eclair/config.rb:56:in `initialize': undefined method `exists?' for File:Class (NoMethodError)

      if !File.exists?(new_conf) && File.exists?(old_conf)
              ^^^^^^^^
Did you mean?  exist?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.