Connect to linux amazon instance to your linux personal computer

In this blog, we will learn how to ssh to your linux amazon instance from your personal computer.

Prerequisites:

– Rhel ec2 instance creation access
– Linux personal computer with proper internet connection.

For connecting to amazon instance from your computer, we need to create a key pair. For doing this,we have to create key pair. A key pair can be created on you computer or from aws site as well.

РIf we create key pair from your computer, then you need to import the public key in your aws,and while creating the instance use that key as part of security profile.

-if we create key pair from amazon then, we need to download the private key and copy to the
linux personal computer, and ssh to ec2 instance using that

Create key pair using the console:

– Open the Amazon EC2 console .
– Slect the region for the key pair.
– In the navigation, under Network & Security, choose key Pairs.
– Choose Create key Pair.
– Enter name for key pair,and create. It will generate a file with .pem extension, which save it.

Note: This file cannot be regenerate or get it again, so please save it at safe place.
– copy the <filename>.pem to your linux box, perform chmod.

chmod 400 <filename>.pem

Import you key pair to amazon EC2:

Instead of using amazon key pair , you can use create an RSA key pair and import the public key to Amazon EC2.

– Generate a key pair with a third party tool of your choice.
– In this case, we are using ssh-keygen. It will generate public and private key.
– Copy public key to a local file

Import the public key

-Open the amazon ec2 console.
-From the navigation, select the region.
-In navigation pane,under network & Security, choose key pair.
-Choose import key pair and browse the public key you have