d. Create a new Key Pair

In this section of the lab you will create a Linux instance and login to it to run a few Linux commands. To log in to an instance, you need to be able to connect via SSH. There are several layers of security for accessing instances that are enabled by default by AWS. One of these is with an SSH key pair, which can (very roughly) be thought of as like a unique username and password.

The following steps outline how to create a new SSH key pair that then you will use to log in to a new Linux instance.

  1. Sign into the AWS Management Console and open the Amazon EC2 console at https://console.aws.amazon.com/ec2

  2. In the upper-right corner of the AWS Management Console, confirm you are in the desired AWS region (e.g., Singapore).

ConsoleEC2KeyPair

  1. In the left navigation pane click on Key Pairs under the Network & Security section. This will display a page to manage your SSH key pairs.

ConsoleEC2KeyPair

  1. On the Key Pairs page click the Create Key Pair button at the top of the browser window.

ConsoleEC2CreateKeyPair

  1. In the resulting pop up window, provide a key pair name of your choosing and select .ppk or .pem depending on which ssh client you will use to connect to the EC2 Instance (For PuTTY select .ppk. For Windows Subsystem Linux, MacOS-X ssh Client, Linux ssh client, Windows ssh client select .pem).

NOTE: For the purpose of this workshop please provide a unique key pair name, so that it might not clash with key pair names provided by other participants using the same AWS account. You could use your name initials in the key pair for easy identification.

ConsoleEC2CreateKeyPairDialog

  1. Click add tag. We’ll get into this later, but tagging is an efficient way to track your resources in AWS. We’ll add two tags to this resource- the user (enter your initials) and an imaginary grant (enter a number, but be consistent). Click on Create key pair.

ConsoleEC2AddTags

  1. The key pair you created should automatically download to your system. Follow any browser instructions to save the file to the default download location. Verify that the file has downloaded and you can locate it. Remember the full path to this .ppk/pem file you just downloaded. This file contains your private key for future SSH connections.

  2. You will see a message appear at the top of the screen that says Successfully created key pair. You will see the key pair you created listed.