Connecting to a Linux instance in AWS using PuTTY A few month ago, I wrote a column that described how to log into a Windows-based instance of Amazon Web Services (AWS). Although I don’t normally write about something so simple as logging into an instance, it is a very useful step for anyone new to AWS. This article will show you how to log in to a Linux server instance. This is why I am covering it. First, it is quite different from logging into a Windows instance. Second, I have shown you how to create a WordPress website in a recent column. Most WordPress instances are Linux-based. There are many ways to access a Linux instance. PuTTY is the utility that we will be using for this article. PuTTY is a client you can use to establish SSH sessions. The download page is available here. PuTTY is designed for Linux instances. However, a Windows version is also available. To connect to an instance using the PuTTY client you will need some information. These include the instance ID, name of the private keys you used when creating the instance, and public DNS name. All of this information can be accessed through the Elastic Compute cloud (EC2) console as shown in Figure 1. [Click on the image to see a larger version.] Figure 1: Gather all the information required from the EC2 console. The next step is to install PuTTY. PuTTYgen is the utility that will allow you to do this. This utility comes with PuTTY and should be installed on your computer. To generate the key you need, open PuTTYgen. Next, choose the SSH-2 RSA option. Next, click on the Load button. Select your private key file. (You will need to select the All Files option to allow the utility to display.PEM files. Next, click on the Save Private Key button (see Figure 2). Do not be alarmed by the message that indicates that a passphrase is not being used. Simply specify a name for your private key file. Figure 2: Click on the Save Private Key button. Now launch PuTTY. You will first need to enter the host name. This can be tricky as the host name will vary depending on the Linux instance. The host name is composed of a user name, @ symbol, and the public DNS address for the instance. The EC2 console can provide the public DNS name, as you can see in Figure 1. The user name will however vary. These are the most popular user names:

  • Amazon Linux: ec2-user
  • RHEL: ec2-user, root
  • Ubuntu: ubuntu, or root
  • Centos: centos
  • Fedora: ec2-user
  • SUSE: ec2-user, root

This list won’t cover all situations, but it will cover most of them. This list won’t work if your Linux instance was created via the AWS Marketplace (as it was for the WordPress site I created a few months ago in this column). If this is the case, click on the instance in the EC2 console and then select the Usage Instructions Tab at the bottom. Figure 3 shows the tab that displays the user’s name (in this instance, it is bitnami). [Click image to enlarge.] Figure 3: Check the usage instructions if all else fails. As shown in Figure 4, enter the host name into PuTTY. SSH Click the Browse button and select the private key file you just created. Then click Open. Figure 5 shows how this works. Figure 4: Enter the host name in [email protected] format. &