AWS Tutorial 08 - Using SSH's Config File with Your AWS Boxes

Sep 20, 2016

Disclaimer: If you’re a hard core Unix head then this can easily be skipped. However if your knowledge of SSH extends to “config file – what?” then it likely is worth a read.

SSH is one of those core bits of the modern computing world that we all rely on and don’t even think about. And, like all such technologies, there is a lot to SSH under the hood. The aspect I’m going to focus on here is the SSH config file and how it can make your AWS development life easier.

Let’s start with how I first logged into one of my production AWS boxes:

That certainly works but it is long. And where you have length then you may the chance for error. And then when you need to transfer a file from server to client (or vice versa) then you need to rewrite it like so:

The SSH Config file

In your ~/.ssh directory there is a file named, simply enough, config. The config file stores a series of entries related to the the host you want to log into. Here’s an example of what logging in using a config file is like:

ssh mariadb

And here is an example of scp’ing a file down to your local box:

scp mariadb:/tmp/foo.txt ~/Downloads

So that is a clear advantage but how do we get there?

You need to edit the file ~/.ssh/config. Do that now with nano or another editor: