I came across a simple yet elegant means of managing multiple Amazon Web Services credentials when using the AWS CLI. This way does not make you have to hack your .aws/config and is the simplest/cleanest way I have found.
First install direnv and make sure it is in your PATH.
Be sure to remember to add the hook to your shell of choice as they outline in their README.
Now that you have direnv setup we can configure it for each client.
I use a directory structure to keep each client in their own directory.
So for example in :
.../clients/ACME/ I make a .envrc file and export my AWS keys in it:
Once you make your .envrc file run direnv allow to enable using the config. Then test your AWS CLI to insure working properly.
Then when you are doing work on that client’s account you simply have to cd into their respective directory.
Be sure to either encrypt the whole directory or at least chmod 600 the .envrc files to protect your keys.
I have been somewhat of a terminal junkie for well over 20 years. Right now some of my favorite CLI applications are:
- Rainbowstream – Twitter on the command line
- IRSSI – IRC client (works with Slack too!)
- MUTT – email client
- MOC – music player
- htop – top but prettier
finch – basic Pidgin for CLI (no OTR support is downside) see update below
- pianobar – Pandora on CLI (no ADs!!!)
- galileo – syncs FitBit via CLI
- vim – text editor
- ngrep – packet analyzer
- nmap – THE port scanner
- dtrx – decompress without the fuss
- dstat – monitor numerous parts of your system
- mtr – traceroute and ping rolled into one
- multitail – tail on steroids
- screen – terminal multiplexer
- netcat – network Swiss Army knife
- WordGrinder – CLI word processor good for serious writing
If using Debian based Linux (Ubuntu, Mint, etc.) just do:
sudo apt-get install siege mtr pv irssi mutt-patched dtrx screen iftop iotop dstat multitail netcat nmap lftp gnupg moc htop finch pianobar python-pip wordgrinder && sudo pip install rainbowstream
Other honorable mentions (terminal related)
- termininator – terminal emulator with a lot of cool features
- guake – drop down terminal
A few more that I have grown to like:
- ranger – file manager with vi like commands, very customizable
- rclone – rsync for cloud storage
- rtorrent – CLI bittorrent client
- profanity – XMPP (Google Talk) CLI interface that supports OpenPGP and OTR inspired by IRSSI
I manage many servers in my line of work and have found a few things to make life a little easier when it comes to SSH’ing into them when I start my laptop up.The first of these is maintaining an up to date ssh config file which is kept in ~/.ssh that allows me to alias the server address and key. A basic entry in the config file would be for an Amazon Web Services EC2 instance:
Once you have all your servers in the config file I create a very simple script to start gnome-terminal with each group of servers:
gnome-terminal --tab --title=prod-servername01 -e 'ssh prdo-servername01' --tab --title=prod-servername02 -e 'ssh prod-servername02'
From the above example you can get the idea of adding more tabs for each additional server. I then create desktop or menu shortcuts for each grouping of server to launch a terminal and ssh into all in the group.