How to connect to EC2 using terminal?

Puneet

There are numerous ways to connect to EC2 via your Mac book or windows machine . 


Few of them are mentioned below

1. Connect using AWS EC2 management console.

2. Connect to EC2 linux instance using SSH protocol

3. Connect to Elastic Cloud compute Machine using  RDP


Connect using AWS EC2 management console

1. Login to AWS account
2. Head to EC2 service
3. Select your instance to whom you want to connect
4. Click connect 
5. Click connect again at below side.

You should be connected in browser window itself.



Connect using SSH Protocol

Prerequisite - 

Key configured with Instance 


Procedure 

1. open was management console, head to ec2 service, Select which instance you want to connect 
2. Click connect button
3. Copy ssh command for that instance 

generally in format as mentioned below
ssh -I "keyname" username@ec2-ip.availability-zone.compute.amazon.aws.com

Note: default name of different linux version or ami may be different by default.


Don't worry ,you don't need to remember the command all is ready to use mentioned in window when you click connect for particular instance, just copy that

4. click command and space bar and search for terminal

5. navigate to folder containing downloaded key using cd and ls command 

6. change permission of private key by following command
chmod 400 "keyname.pem"

Note : key can be downloaded in two format that is .pem or .ppk, Mae sure you have created .pem format

7. paste the command you copied at step 3, hit enter


You should be connected to terminal.


Frequently Asked Question

Q. What is SSH Protocol?

Q. What is EC2?

Q. What is RDP?

Q. What is difference between Ansible and Terraform?

Q. What is Infrastructure as code?

Q. What other options are there apart from Terraform?

Q. Why to use the key when I know the password of your was management console?

Q. What will you do if you lost your EC2 instance key?

Q. How can you copy the file from your pc to EC2 instance?


Did you knew these methods comment below

Getting Info...

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.