Simple Instructions for Connecting to AWS EC2 Instances

Hi, How are you !! Hope you doing good....
I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.
So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.
In the last blog we learnt, how to create EC2 Instance. Now we will learn multiple ways in which you can connect to EC2 Instance in AWS Cloud Service Provider. We will see some of those ways which can be used by the Beginners as well as used in Industry…
1st Way - Connecting using EC2 Instance connect
(It’s used for learning purpose)
Select the EC2 Machine
Click on connect
Go to the EC2 Instance connect

Click on connect

2nd Way - Using SSH Client
(It can be used for learning purpose and work purpose as well)
If you are using Windows machine -> Open the cmd
Change the directory to the folder where the "Key-pair" is downloaded of the machine

Now select the machine, which you want to connect
Click on connect
Go to the SSH Client option

Now copy the "ssh command given" in the cmd and hit enter and say yes
Ex. ssh -i "test.pem" ubuntu@ec2-x-x-x-x.compute-1.amazonaws.com
Here,
ssh = Is Linux command to connect with ubuntu machine
-i is the identity file "test.pem" = Is a key-pair.
ubuntu = Username of ubuntu machine
ec2-x-x-x-x.compute-1.amazonaws.com = DNS or IP of machine.

You will be connected to the Ubuntu EC2 machine from your Windows laptop.

3rd way - Using MobaXterm.
(It best practice to connect to EC2 machines) MobaXterm is a s/w which is best practice to connect to the EC2 machine, irrespective of the OS of EC2 machine and OS of the user’s laptop.
Open the MobaXterm s/w -> Click "Session" on top left corner. Then you will see lot of connections like RDP, SMTP, SSH, etc.

As we want to connect to Linux EC2 -> Click on SSH ->
In Basic SSH settings, Put the username of EC2 which will be ubuntu in the Username and in Remote Host put the DNS of Ubuntu EC2 which will be there in AWS Console SSH Client page after ‘@’


Then below in "Bookmark Settings" -> Give the "Session name" as you want as "Ubuntu-First-EC2" because if we want to connect to 10 different EC2 then with the help of Session name we can differentiate.

Then in "Advanced SSH Settings" -> Checkbox the "Use private key" -> Then browse the .pem file from local machine where the .pem key-pair is downloaded -> Select it and Click on Open -> Click on "OK" -> Click Accept.

Done we are connected from the "Windows laptop to Linux EC2" with the .pem key-pair, instead of converting .pem key-pair to .ppk key-pair.

Conclusion
So, there are many other ways in which the EC2 Instance can be connected, like using Putty or with AWS CLI. The above mentioned steps, are beginner friendly and can be understood easily…
Hope you enjoyed and understood ways of connecting to EC2 Instance. Do like, share, comment your thoughts and feel free to connect for more information




