About Us
IDKBlogs

  All  
Javascript
NodeJS
AngularJS
Angular2+
ReactJS
Others

Remote access of AWS EC2 Linux Instance using SSH

Connect your local terminal/CMD to your server using ssh command.

  idkblogs.com      July 25, 2019

Shubham Verma

Shubham Verma


Remote access of AWS EC2 Linux Instance using SSH

S


ome time it is required to take the remote access of our server, then we should have a better way to connect the server for any update on the server. The best way to take the remote access by "SSH" command. This is very easy and fast. You can connect your server in a while.
Here I will explain how we can take the remote of AWS EC2 instance or we can say EC2 terminal using public IP. We can get public IP after creating the EC2 Instance. Before doing this we need to know What is AWS EC2? and How we can create an EC2 Instance?. For this I have already published articles you can check it, below are links:

What is AWS? - A breaf intro.
Create an AWS EC2 Instance?

After creating AWS EC2 Instance we must have :

* A public IP something like 34.219.193.28

* A security file something like demo-instance.pem

Now we will use the above data to take the remote access. So, let’s move ahead step by step:

Step 1: Open your terminal and locate demo.pem file:

In this step, we need to navigate the terminal to the location where you have downloaded the “demo-instance.pem” file. Here I have:

Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP

Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP

Step 2: Give the permission to that file, Run below command:

chmod 400 demo-instance.pem
Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP

Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP.


Why chmod 400:

"chmod 400 FILE_NAME" command is basically used to give the read permission, this command will removes all the existing permission. These permissions are basically used to protect this file against the renaming, moving, removing, accidental overwritig etc.

Step 3: Now run below SSH command to connect Linux instance of EC2:

ssh -i FILE_NAME [email protected]__PUBLIC_IP

It means you need to run:

ssh -i demo-instance.pem [email protected]
Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP

Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP.

After the above command, you can see your terminal/CMD is connected with AWS EC2 Instance. To do anything on this remote terminal, we need to update all the things, to do this hit below command :

sudo apt-get update
Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP

Take remote access of AWS EC2 Linux Instance/Terminal using SSH and public IP.

Now, you have remote access of your server:


After the remote access you can assume that this is your local terminal, and you can ran any command which you can run in your local linux terminal. You can update your project, add/edit/remove the directory accordingly.
Having the access of server is very important and useful in software development, every developer should know about the remote access using SSH command.


Conclusion:

In this article, we learned How we can take the remote of AWS EC2 instance or we can say EC2 terminal using public IP? and also learned about the SSH command and EC2 terminal.


Thank you

for taking the time to read this article. If you’re interested in Node.js or JavaScript this link will help you a lot.



Copyright © 2020 IDKBlogs | All Right Reserved

About Us

Powered by : IDKBlogs

Last Update : 19/09/2020