Due to limitations in adding features & extending aws-ssh, I've created blaze-ssh. It adds features like cached instance list & configurable address type (private/public). Please use blaze-ssh instead of aws-ssh.
aws-ssh
is a bash script for conveniently ssh-ing into AWS EC2 instances.
it uses fzf
, jq
& aws-cli
under the hood.
- aws-ssh requires bash to be installed (even when running the script in other shells)
- make sure you have the following programs installed
aws configure
should've been run & authenticated prior to using aws-ssh
- fetch the
aws-ssh
script usingwget
wget https://raw.githubusercontent.com/sreedevk/aws-ssh/main/aws-ssh -P ~/.local/bin
NOTE: run echo $PATH
& ensure that ~/.local/bin
is included in $PATH.
- Run
chmod
to mark~/.local/bin/aws-ssh
as executable
chmod +x ~/.local/bin/aws-ssh
=======================================================================
AWS-SSH: Connect to AWS EC2 Instances at Lightning Speed
=======================================================================
Usage:
list instances: aws-ssh list <partial-search-term>
connect: aws-ssh connect <partial-search-term> <username>
private ip connect: aws-ssh priconn <partial-search-term> <username>
public ip connect: aws-ssh pubconn <partial-search-term> <username>
Notes:
<partial-search-tearm> matchs "instance name" and "instance id"
<username> will be taken from ~/.aws-ssh-config if not provided
Bastion Servers can be configured in ~/.aws-ssh-config
Private Keys (*.pem) can be configured in ~/.aws-ssh-config
Example ~/.aws-ssh-config:
PRIVATE_KEY=~/.ssh/somekey.pem
[email protected]
DEFAULT_USER=ec2-user
aws-ssh
can be configured to set some default options.
The configuration file for aws-ssh
should be present at ~/.aws-ssh-config
.
The ~/.aws-ssh-config
is just a bash script that is sourced by aws-ssh
before execution.
The following can be added to ~/.aws-ssh-config
- PRIVATE_KEY
The path to the key to be passed into the -i
option while ssh-ing. if not configured, the -i
is omitted.
PRIVATE_KEY=~/.ssh/somekey.pem
- BASTION The jump/bastion server to use while ssh-ing into ec2-instances.
- DEFAULT_USER
if the username part is omitted while using
aws-ssh connect <instance-name> <username>
, theDEFAULT_USER
will be used. This can be beneficial if you have the same username for most ec2-instances, as you won't have to type the username each time.
DEFAULT_USER=ec2-user
EXAMPLE ~/.aws-ssh-config
PRIVATE_KEY=~/.ssh/somekey.pem
[email protected]
DEFAULT_USER=ec2-user