Nick Hardiman shows you how to set up a secure connection to an Amazon EC2 machine using PuTTY and Pageant to handle your private key.
Last time, I created a virtual machine using the AWS console. Amazon people call this “launching an instance”. The only way of talking to my new EC2 machine is by following the SSH (Secure SHell) protocol.
My new machine is running an SSH service. I must use an SSH client to connect to it. There is no other way in. It is not running any web interface or fancy GUI, and it won’t talk any older protocol like telnet, ftp or – God forbid – rlogin.
I need an SSH client that will run on my Microsoft OS. Most people in the world typing away at computers are running a Microsoft OS – probably Windows 7 or XP. I use it at work. If Linux dominated the world, I could use OpenSSH but business desktop reality still has Microsoft at its heart.
Simon Tatham’s PuTTY is my favourite Windows SSH client. AWS people use PuTTY. It is free, it does everything I need, and it is stable. In the past, I used a few other open source clients with Windows, like OpenSSH and TeraTerm, and some closed source ones, such as MindTerm, SecureCRT, and Tectia SSH. Is it my imagination, or is mixing caps important when naming an SSH application?
This installs the SSH client and a collection of related goodies.
I follow this procedure about once a year. That’s the frequency I trash an OS and have to re-install everything.
The PuTTY application is now ready to roll. Before I can use it to talk to my EC2 machine, I must convert my private key to a PuTTY-friendly format and load the key into the SSH authentication agent.
When I created my first EC2 machine the AWS console gave me a private key to save. The private key I downloaded is in a format called PEM (Privacy-Enhanced Mail – that “mail” word gives you a clue about why the PEM format was invented).
PuTTY can’t use PEM files. It only understands its own PPK format. I can translate the PEM file to a PuTTY-format PPK file using PuTTYgen.
The PuTTY application comes with an SSH authentication agent called Pageant. The only purpose of Pageant is to keep all my private keys ready for PuTTY to use. PuTTY needs my AWS private key when it connects to my EC2 machine.
Pageant is a time saver: I can log into my machine many times during the day without typing my passphrase. I repeat this procedure every time I boot my computer, at the start of my working day.
ssh-rsa 2048 12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef aws-privkey-for-planetlarg
Those four fields are type of key, size in bits, fingerprint, and comment.
Nick Hardiman builds and maintains the infrastructure required to run Internet services such as the web. Nick deals with the lower layers of the Internet - the machines, networks, operating systems and applications. Nick's job stops there and he hands over to the designers and developers who build the top layer that customers use.