Remote access of AWS EC2 Linux Instance using SSH

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

🙋‍♂️ Shubham Verma    🗓 July 25, 2019


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 ubuntu@INSTANCE__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.



Support our IDKBlogs team

Creating quality content takes time and resources, and we are committed to providing value to our readers. If you find my articles helpful or informative, please consider supporting us financially.

Any amount (10, 20, 50, 100, ....), no matter how small, will help us continue to produce high-quality content.

Thank you for your support!




Thank you

I appreciate you taking the time to read this article. The more that you read, the more things you will know. The more that you learn, the more places you'll go. If you’re interested in Node.js or JavaScript this link will help you a lot.

If you found this article is helpful, then please share this article's link to your friends to whom this is required, you can share this to your technical social media groups also. You can follow us on our social media page for more updates and latest article updates.
To read more about the technologies, Please subscribe us, You'll get the monthly newsletter having all the published article of the last month.