Thursday, March 30, 2017

Creating a Key Pair for EC2

In the next few we will look into how to create Linux and Windows instances and then login into those instances. But, before that we need to create a Key Pair.

Usually, username/password combinations are used to login into a Linux or a Windows instance. But, in the case of AWS a Key Pair is used to login by default. We can also change the authentication from the default Key Pair to username/password. There are pros and cons of both username/password and Key Pairs. More about the Key Pairs here.

AWS provides a management console (1), which is sort of Web UI to manage the different services. Each service has a different management console (EC2 has one, S3 has one, VPC has one etc). Open the management console (1) in a browser and enter the credentials. Search for EC2 and select `EC2 - Virtual Servers in the Cloud`.

The EC2 management console looks like as below.

In the left pane click on the Key Pairs. When you login for the first time into the AWS management console, there won't be any Key Pairs.

Click on `Create Key Pair` to create a new one. Give it a name.

You will be promoted to download a file with a pem extension. The file name will be the same as the Key Pair name. Save the file in a safe location, without this file it won't be possible to login to the EC2 instances (Windows and Linux). Usually I store them in Dropbox. Also, don't share this file with others as they would be able to login to your Windows and Linux instances which you own.

The Key Pair which has been created appears in the console as shown below. Upto a maximum of 5,000 Key Pairs can be created per Region. We will look into what a region is in one of the upcoming blog.

Note that there is no charge to create a Key Pair in AWS. In the upcoming blog, we will look into how to create a Linux and Windows instance and log into it.

1 comment: