GithubHelp home page GithubHelp logo

robomfeinberg / elastic-ssh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from goodwillaz/elastic-ssh

0.0 0.0 0.0 37 KB

Command line utility to connect to EC2 instances using IAM and personal SSH keys (optionally through a bastion host)

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

elastic-ssh's Introduction

AWS EC2 SSH Utility

This is a command line utility to assist in connecting to EC2 via SSH using IAM and EC2 Instance Connect. It also allows connecting to private instances via a Bastion Host if you have one configured in your VPC. This currently only works on *nix command lines with the OpenSSH client installed at /usr/bin/ssh.

AWS Setup

Follow Amazon's documentation on setting up Instance Connect.

Installation

Install via your favorite method for installing Python-based CLI tools: pip, pipenv, easy_install, etc. I recommend using pipenv, creating an environment just for this tool and then creating a symlink from the virtualenv bin directory to a directory on your PATH.

$ pipenv install -e git+https://github.com/goodwillaz/elastic-ssh\#egg=elastic-ssh
$ sudo ln -s `pipenv --venv`/bin/aws-ec2 /usr/local/bin/aws-ec2

Once you've installed the utility, you'll need to configure it. It uses AWS's Boto library which means it will look in the standard places for AWS Credentials. To configure the utility with an optional profile name (default is default):

$ aws-ec2 [--profile <profile>] configure

Note that the private key you are prompted for does not need to be the key-pair you used to create your EC2 instance. You can use any RSA based key-pair. The public key must sit in the same folder as the private key and have a .pub suffix to it.

Usage

Simply type aws-ec2 ssh on the command line; you'll be provided with a list of instances (and their names) for easy selection. Select the instance you'd like to connect to and you'll instantly be connected!

For help, simply run aws-ec2 --help or aws-ec2 <command> --help

Environment Variable Support

All the command line flags can be specified as environment variables (if you need to):

  • AWS_EC2_DEBUG
  • AWS_EC2_PROFILE
  • AWS_EC2_SSH_USER
  • AWS_EC2_SSH_PORT
  • AWS_EC2_SSH_KEY
  • AWS_EC2_SSH_COMMAND

License

See the LICENSE file for license rights and limitations (BSD 3-clause).

elastic-ssh's People

Contributors

mattzuba avatar dependabot[bot] avatar

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.