3 releases
0.0.4 | Dec 20, 2023 |
---|---|
0.0.3 | Dec 16, 2023 |
0.0.2 | Dec 15, 2023 |
#11 in #ec2
35KB
745 lines
Blaze SSH
Description
Blaze SSH is a configurable CLI tool that helps you ssh into amazon aws ec2 instances without leaving your terminal.
It is build with Rust and uses the official AWS SDK for Rust.
configuration is done using a .toml
file ("~/.config/blaze/config.toml"
by default).
Motivation
I have been using aws-ssh for a while now. Its a great tool but with all of the dependencies like fzf, jq, aws-cli etc., It has been difficult to come up with an effective way to package the application into an easily installable format. Also as someone that enjoys experimenting with with new shells, its inconvenient to have to switch back to zsh just to be able to use aws-ssh.
This tool attempts to solve the problem by keeping the dependencies at a minimum and using Rust to build a single executable binary. A few conveniences of aws-ssh are missing, but will be added soon along with some additional features like aws-ecs support.
Installation
Currently, the only way to install blaze is using cargo:
$ cargo install blaze-ssh
After installation, make sure to create a config file at ~/.config/blaze/config.toml
. See Configuration for more details.
You may use the configure
command to generate a default config file.
$ blssh configure
Usage
Usage: blssh [OPTIONS] <COMMAND>
Commands:
connect connect to an ec2 instances
list list filtered ec2 instances
configure generate default config (~/.config/blssh/config.toml)
help Print this message or the help of the given subcommand(s)
Options:
--no-cache disable using cached ec2 instances list
-c, --config <CONFIG> config
-h, --help Print help
# Connection Opts
connect to an ec2 instances
Usage: blssh connect [OPTIONS] [SEARCH]
Arguments:
[SEARCH] Search String to filter instances by
Options:
-u, --user <USER> ssh username
-p, --port <PORT> ssh port
-k, --key <KEY> ssh private key
-a, --address-type <ADDRESS_TYPE>
-j, --jumphost <JUMPHOST> jumphost
-h, --help Print help
Configuration
Currently, blaze-ssh expects to find a config file at ~/.config/blaze/config.toml
. Please make sure to create this file.
[config]
private-key = "~/.ssh/id_rsa.pem"
default-user = "ec2-user"
jumphost = ""
port = 22
address-type = "private"
Examples
Listing Instances
# Lists all instances that contain the term "staging" in their "Name" tag
$ blssh list staging
Connecting to an Instance
# Interactively select an instance to connect to from a list of instances that contain the term "production-1" in their "Name" tag
$ blssh connect production-1
# Connecting with a non default (configured in ~/.config/blaze/config.toml) private key
$ blssh connect production-1 --key ~/.ssh/production.pem
# Connecting with a non default (configured in ~/.config/blaze/config.toml) user
$ blssh connect production-1 --user ubuntu
# Connecting with a non default (configured in ~/.config/blaze/config.toml) port
$ blssh connect production-1 --port 2222
# Connecting with a non default jumphost host
$ blssh connect production-1 --jumphost "user@192.168.1.1"
# Connecting with a non default (configured in ~/.config/blaze/config.toml) address type
# Options are "public" & "private"
$ blssh connect production-1 --address-type public
# Connect using a custom config
$ blssh --config ~/custom-config.toml connect production-1
# Disable use of cached instance information (stored in /tmp/blaze_ssh_cache.json)
$ blssh --no-cache connect production-1
Known Issues
- When navigating using j/k on the connect ui, the list scroll doesn't work.
- The behavior without a config file is untested.
Roadmap
- Fix known Issues
- Package application for distribution
- If only one instance is found, connect to it directly without showing the connect ui PR #1
Dependencies
~79MB
~1M SLoC