Skip to main content

awssh

SSH boto3 utility for AWS

Installation

First, install the aws-cli and boto3 libraries:

pip install awscli --upgrade --user
pip install boto3

Next, set up credentials and default region:

aws configure

Finally, install the awssh utility:

pip install --user ssh-aws # or pip install ssh-aws

Note: The awssh utility is installed in $HOME/Library/Python/2.7/bin which may not be on PATH. Consider adding this directory to PATH.

Version update

echo y | pip uninstall ssh-aws
pip install --no-cache --user ssh-aws
awssh --version

Requirements

  • Python 2.7
  • boto3
  • aws-cli

Features

The awssh utility gives you a list of aws instances and preconfigures ssh with the proper key and user. You can filter by instance name. If it matches only one instance you will be logged into it. This utility also allows local and remote port forwarding for SSH tunneling (e.g. ssh -L 9000:imgur.com:80 user@<ip_address>). By default, ssh command is executed with the -A option, which enables forwarding the authentication agent connection. This is particularly useful when using a single access point such as a jump server. In addition, if an instance without an external IP is selected, the utility attempts to find a bastion server and ssh with the -t option (e.g. ssh -A ubuntu@<bastion> -t ssh <ip_address>).

Usage

usage: awssh [-h] [--users USERS [USERS ...]] [--region REGION]
             [-i KEY_PATH] [-c COMMAND] [-r REMOTE_HOST]
             [-p REMOTE_PORT] [-l LOCAL_PORT] [--keys KEYS]
             [--timeout TIMEOUT] [--console-output] [--profile PROFILE]
             [--version]
             [filter]

SSH into AWS instances.
e.g.: "awssh --profile prod-acc-2 --users fduran --region us-east-2 instance-name -c top".
The default user list is centos, ubuntu, and ec2-user:
e.g.: "awssh --profile prod-acc-2" will attempt ssh with default users.
Due to the nature of nargs, "awssh --users user1 user2 instance-name" will not be parsed properly. 
Instead try: "awssh instance-name --users user1 user2".

positional arguments:
  filter                Optional instance name or key word as a filter. If
                        only one instance is found, it will connect to it
                        directly.

optional arguments:
  -h, --help            show this help message and exit
  --users USERS [USERS ...]
                        Users to try (centos, ubuntu, and ec2-user are
                        defaults).
  --region REGION       AWS region (User default if non is provided).
  -i KEY_PATH, --key-path KEY_PATH
                        Specific key path, overrides, --keys
  -c COMMAND, --command COMMAND
                        Translates to ssh -t
  -r REMOTE_HOST, --remote-host REMOTE_HOST
                        Open a tunnel. Equivalent to ssh -L <local-port
                        >:<remote-host>:<remote-port> <selected-aws-host>
  -p REMOTE_PORT, --remote-port REMOTE_PORT
                        Port to use on the remote host (default is 5432).
  -l LOCAL_PORT, --local-port LOCAL_PORT
                        Port to use on the local host. Get overwritten by
                        remote port if not defined.
  --keys KEYS           Directory of the private keys (~/.ssh by default).
  --timeout TIMEOUT     SSH connection timeout.
  --console-output, -co
                        Display the instance console out before logging in.
  --profile PROFILE     Use a specific profile from your credentials file.
  --version, -v         Returns awssh's version.


  Examples:
    awssh --users fduran --profile prod-acc-2 --region us-east-2
    awssh --users user1 user2 --region us-east-2 --keys '~/.ssh' instance-name
    awssh instance-name --users user1 user2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssh-aws-2.4.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssh_aws-2.4.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file ssh-aws-2.4.1.tar.gz.

File metadata

  • Download URL: ssh-aws-2.4.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.7

File hashes

Hashes for ssh-aws-2.4.1.tar.gz
Algorithm Hash digest
SHA256 8a6b8c8369f753043cc9f6deb7f064ab9863e02d7caccf773828b11facdcccb7
MD5 6deadb444bb4106c45c7fd9e616759a4
BLAKE2b-256 544ccd0d56fd13cd2706329d76cb0ec34bee3db58c9fddf3fe637865959853f9

See more details on using hashes here.

File details

Details for the file ssh_aws-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: ssh_aws-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.5.7

File hashes

Hashes for ssh_aws-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6e7c66b80cb120f15103742fc5959ded531929139f5cc5f0e4eef27b2feb8394
MD5 fee70ef32b6508448c5e8018eb9a4d89
BLAKE2b-256 84e5d83650ae131a76685b31215d1ad541fcc9b69e373db6a46ad4697cc7104b

See more details on using hashes here.

Release history Release notifications | RSS feed

4.1.6

2 files

4.1.4

2 files

4.1.3

2 files

4.1.2

2 files

4.1.1

2 files

4.0.9

2 files

4.0.8

2 files

4.0.7

2 files

4.0.6

2 files

4.0.5

2 files

4.0.4

2 files

4.0.3

2 files

4.0.2

2 files

4.0.1

2 files

3.0.8

2 files

3.0.6

2 files

3.0.5

2 files

3.0.4

2 files

3.0.3

2 files

3.0.2

2 files

3.0.1

2 files

3.0.0

2 files

2.4.7

2 files

2.4.6

2 files

2.4.5

2 files

2.4.4

2 files

2.4.3

2 files

2.4.2

2 files

This release

2.4.1 This release

2 files

2.4.0

2 files

2.3.9

2 files

2.3.8

2 files

2.3.7

2 files

2.3.6

2 files

2.3.5

2 files

2.3.4

2 files

2.3.3

2 files

2.2.3

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.7

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

3 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.1.0

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page