Skip to content

NoUseFreak/sawsh

Repository files navigation

sawsh

Build status Release Report License Coffee

SSH wrapper for aws to make your life easier.

Features

  • Lookup AWS EC2 instances by name.
  • Lookup ip by ip-xxx.xxx.xxx.xxx format.
  • Transparant connect to ip

Usage

$ sawsh webserver

This example will query AWS for a EC2 instance containing the name webserver. It will prompt you with a choise when more than one result is found.

$ sawsh webserver
+---+--------------------+-------------+-------------------------------+
|   |        NAME        |      IP     |          LAUNCHTIME           |
+---+--------------------+-------------+-------------------------------+
| 0 | prod-webserver-1   | 10.1.1.10   | 2018-02-01 21:13:44 +0000 UTC |
| 1 | prod-webserver-2   | 10.1.2.10   | 2018-03-15 18:57:02 +0000 UTC |
| 2 | prod-webserver-3   | 10.1.3.10   | 2018-04-19 18:04:07 +0000 UTC |
| 3 | prod-webserver-4   | 10.1.1.11   | 2018-02-15 12:36:45 +0000 UTC |
| 4 | prod-webserver-5   | 10.1.2.11   | 2018-06-07 15:54:00 +0000 UTC |
| 5 | prod-webserver-6   | 10.1.3.11   | 2018-06-07 15:54:00 +0000 UTC |
+---+--------------------+-------------|-------------------------------+
Pick a number: 1
Connecting to 10.1.2.10 ...
$ sawsh -h
Query and connect to ec2 instances

Usage:
  sawsh [flags]
  sawsh [command]

Available Commands:
  connect     Connect to an instance
  help        Help about any command
  list        List instances

Flags:
  -d, --debug              Enable debugging
  -h, --help               help for sawsh
      --ssm                Try connecting using AWS Service Manager
  -v, --verbosity string   Log level (debug, info, warn, error, fatal, panic (default "info")

Use "sawsh [command] --help" for more information about a command.

Install

Official release

Download the latest release.

brew install nousefreak/brew/sawsh

or using curl

curl -sL http://bit.ly/gh-get | PROJECT=NoUseFreak/sawsh bash

Build from source

$ git clone https://github.com/NoUseFreak/sawsh.git
$ cd sawsh
$ make
$ make install

Upgrade

To upgrade to the latest repeat the install step.

Configure

Setup sure your aws-cli is setup. That user needs ec2:Describe* permissions.

Suggestion

It may be useful to setup some aliases if you use multiple aws accounts or want it to run with a non standard profile.

$ alias prod_ssh='AWS_PROFILE=prod sawsh'

License

FOSSA Status