- Notifications
You must be signed in to change notification settings - Fork2
Connect to AWS EC2 Instances at Lightning Speed
License
sreedevk/aws-ssh
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Due to limitations in adding features & extending aws-ssh, I've createdblaze-ssh.It adds features like cached instance list & configurable address type (private/public).Please useblaze-ssh instead of aws-ssh.
aws-ssh
is a bash script for conveniently ssh-ing into AWS EC2 instances.it usesfzf
,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: runecho $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 providedBastion Servers can be configured in ~/.aws-ssh-configPrivate Keys (*.pem) can be configured in ~/.aws-ssh-configExample ~/.aws-ssh-config:PRIVATE_KEY=~/.ssh/somekey.pemBASTION=username@192.168.50.100DEFAULT_USER=ec2-user
aws-ssh
can be configured to set some default options.The configuration file foraws-ssh
should be present at~/.aws-ssh-config
.
The~/.aws-ssh-config
is just a bash script that is sourced byaws-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
- BASTIONThe jump/bastion server to use while ssh-ing into ec2-instances.
BASTION=username@192.168.50.100
- DEFAULT_USERif 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.pemBASTION=username@192.168.50.100DEFAULT_USER=ec2-user