Header Ads

Header ADS

How to access EC2 instance from Linux shell?

 

As you are in this tutorial so it is safe to assume that you have already launched an EC2 instance in AWS. And you have downloaded the .pem file for your Linux PC or .ppk file for your windows PC. But as I use Ubuntu 22.04 LTS so i will show you how to access EC2 from Linux shell.

Step 1: Log in to your management console. As you have already set up an EC2 instance you should know the drill. Search on the search bar or from console dashboard click on EC2. Which will take you to EC2 dashboard. 

Step 2: If you have already created a EC2 instance but in the dashboard running instance is showing 0 then probably you are in the wrong region. Choose your region and click on the instance(running) option. 

Step 3: Now here you should see something like below:


Now, in the field below name you should see your instance name but i had to cover it cause this is a production site. At this moment you cannot click on the connect button. But there should be square box beside the name, click on that and then click connect.

Step 4: Now here you should see something like below:


Click on SSH client. There should have the necessary information to connect to the instance.

Step 5: Now go to the folder where you have saved the key(.pem file). Then open the terminal there. On the terminal write  chmod 400 key.pem

 Here replace key.pem with your key name. Or just copy 3rd point from SSH Client tab.

Step 6: Then again write :

ssh -i "key.pem" ubuntu@ec2-IP-adress.region.compute.amazonaws.com

 Here replace key.pem with your key name , IP address and region with your ec2 region. Or just copy 4th point from SSH Client tab.

WOW!!!!!!!

This should take you to terminal of your EC2 server. Where you can install anything like you install in linux. Using command like sudo apt install. How to setup a wordpress and moodle site will be discussed in another post. But before that you should know the basic commands needed for linux. Go to this  link for 50 Basic Commands. 50 basic Linux commands

No comments

Theme images by tomograf. Powered by Blogger.