I want to fire up a new virtual EC2 machine from a Basic Amazon Linux AMI, log in, and work the CLI (Command Line Interface).

I carried out a fair bit of preparation to get to this point. I signed up for AWS, installed PuTTY, copied my private key from a PEM file to a PPK file using PuTTYgen and loaded the PPK file into Pageant. I also opened the AWS console to get familiar with it and both created and destroyed an EC2 virtual machine.

This procedure proves the AWS utility approach is not just hype. I am not being misled by over-caffeined  managers — infrastructure really is available on demand to me. In the morning, revving myself up for a new project, I can accelerate from idle to a cluster of computers in minutes.

Next steps are to connect to my EC2 machine, install server-side applications and put it to work. My Windows machine contains the two client-side applications I need to connect: a web client (Firefox, my web browser) to open the AWS console and an SSH client (PuTTY and Pageant) to open a CLI.

I can only contact my new EC2 machine using SSH (Secure SHell). I can’t use a web browser or ping the machine, and I certainly can’t walk up to it and poke it. The machine is hosting very few services but there is an SSH server.

First I start a new EC2 virtual machine and then I gather a little information on it. I need a few configuration details to make SSH work.

  • my AWS private key
  • my account name. The factory-fitted account name for a Basic Amazon Linux AMI is ec2-user.
  • my new machine’s FQDN (Fully Qualified Domain Name).
Click to enlarge.

Open a CLI on the EC2 machine using SSH.

This is the Microsoft Windows method for connecting — if I was using a Linux computer I would enter an OpenSSH command like this at a CLI:

ssh -i ./aws-privkey-for-planetlarg.pem ec2-user@ec2-1-2-3-4.eu-west-1.compute.amazonaws.com.
  1. Open PuTTY. The Session window appears, with basic options for the PuTTY session
  2. Copy the FQDN into the Host Name text box at the top and click the Open button at the bottom. The window disappears and two new windows open the CLI window and a security warning about the server’s host key. This is the only time I will see this window for this EC2 machine.
  3. Click Yes to store the fingerprint permanently. The warning window closes, Pageant helps with the login, and the CLI window displays this banner message and a prompt.
user@ec2-1-2-3-4.eu-west-1.compute.amazonaws.com
       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|
 See /usr/share/doc/system-release/ for latest release notes.
 No packages needed for security; 1 packages available
 [ec2-user@ip-10-4-3-2 ~]$

Flex your sysadmin muscles.

The is the point of exit from the new easy world of cloud computing and re-entry into the old awkward world of  Linux systems administration. There is no way to progress with one of Amazon’s free micro instances without sysadmin skills. If ls, pwd and cd don’t mean anything to you, you are about to drive down a rocky road. Linux is the least intuitive operating system in the world.

This Amazon flavour of Linux is a version of RHEL (Red Hat Enterprise Linux). Red Hat is to Linux what Apple is to BSD. Enterprise Linux is Red Hat’s product line aimed at business users. It has been around about as long as AWS, aims for reliability rather than cutting-edge features and is well supported.

If you have used RHEL before, you may be familiar with the Gnome desktop but may know nothing about BASH (Bourne Again Shell), YUM (Yellowdog Updater Modified) and compiling applications from source code with build-essentials. The technical challenge of Linux administration is a well trodden path and can be overcome with time and a big fat instruction manual. If you have not mastered the bash command line then this is a good place to learn. Who wants the overhead of forcing dual-booting or a hypervisor onto their PC?

Close the CLI.

Type Exit, hit [CTRL]D or just close PuTTY. This ends your conversation with your server.