sshaws
is a helper to simplify the AWS instances ssh access.
It will show a list of instances depending on some specified tags and help you to ssh on it.
usage: sshaws [--silent true] [--region xx_yy_j] [-l user ] [-ssh true] [-k true] [instance_name]
# List all the instances from eu-west-1
> sshaws
Name: * Region: eu-west-1
---------------------------------------------------------
ID NAME IP INSTANCE ID SIZE LAUNCHTIME
0 front-prod-1 172.16.31.12 i-0978df6a92b39d434 t2.nano 2020-12-18 08:08:08
1 front-prod-2 172.16.24.226 i-0b3914e83516392378 t2.nano 2020-12-18 08:08:08
2 front-staging 172.16.39.121 i-0b3914e89237829ad1 t2.micro 2020-12-18 08:08:08
3 back-prod 172.16.33.21 i-0b3914421237829ad1 t3.large 2020-12-18 08:08:08
4 back-staging 172.16.19.93 i-0b391351e237829ad1 t3.micro 2020-12-18 08:08:08
Which one do you want to ssh in?
# WAITING INPUT FROM USER
3
>> Starting a new ssh session to 172.16.33.21
[...] Stablishing SSH connection with the desired server
# List all the instances with front on name, from eu-west-1
> sshaws front
Name: front Region: eu-west-1
---------------------------------------------------------
ID NAME IP INSTANCE ID SIZE LAUNCHTIME
0 front-prod-1 172.16.31.12 i-0978df6a92b39d434 t2.nano 2020-12-18 08:08:08
1 front-prod-2 172.16.24.226 i-0b3914e83516392378 t2.nano 2020-12-18 08:08:08
2 front-staging 172.16.39.121 i-0b3914e89237829ad1 t2.micro 2020-12-18 08:08:08
Which one do you want to ssh in?
# WAITING INPUT FROM USER
0
>> Starting a new ssh session to 172.16.31.12
[...] Stablishing SSH connection with the desired server
Download the binary in this repository and execute it, or compile by yourself following the next steps.
sshaws --help
Usage of sshaws:
-k Push temporal public key to instance [short mode]
-l string
SSH login name (default "ubuntu")
-n string
Instance Name [short mode] (default "*")
-name string
Instance Name (default "*")
-region string
AWS Region (default "eu-west-1")
-silent
Show only IP
-ssh
Use SSH instead of SSM [short mode]
-version
Display app version
There are some basic prerequisites :
- AWS CLI tool
- Session Manager Plugin. If you want to connect using ssm.
- SSH: You will need ssh, and, if necessary, configure the ssh connection (The configuration in
~/.ssh/configuration
will be applied to sshaws). - [OPTIONAL] Golang: If you want to compile
sshaws
you will need thegolang
executable.
Configure your credentials ~/.aws/ with the correct keys.
- ~/.aws/config
[default]
region = eu-west-1
- ~/.aws/credentials
[default]
aws_access_key_id = AKIAXXXXXXXXXXXXX
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
- [OPTIONAL]
ec2-instance-connect
: If you want to copy the keys to the server, you will need to installec2-instance-connect
package in the server
# Download latest version from https://github.com/uritau/sshaws/releases/latest
sudo wget -O /usr/local/bin/sshaws https://github.com/uritau/sshaws/releases/latest/download/sshaws
# Give it execution permissions
sudo chmod +x /usr/local/bin/sshaws
# Download latest version from https://github.com/uritau/sshaws/releases/latest
sudo wget -O /usr/local/bin/sshaws https://github.com/uritau/sshaws/releases/latest/download/sshaws.mac
# Give it execution permissions
sudo chmod +x /usr/local/bin/sshaws
After downloading this repository:
# Enter repository folder
cd sshaws
# Build the binary
go build -o sshaws cmd/sshaws/main.go
# Move to a desired folder
sudo mv sshaws /usr/local/bin/sshaws
# Run the test recursively
go test ./...
Please create a fork and create a PR! It would be awesome to have new proposals!
Travis is configured to automatically build and update the version. (You can change the current version on version.go).
This project is licensed under the MIT License - see the LICENSE.md file for details