Pages

connect to an EC2 instance from Windows or Mac

 

How to connect to an EC2 instance from Windows or Mac

Pre-requistes:

1. SSH keys(for e.g., myEc2Jenkins.pem) already downloaded in your local machine, preferably in downloads folder.
2. Your EC2 instance is up and running in AWS
3. For windows laptop, you need to use Git bash. You can install Git by downloading from this URL - https://git-scm.com/downloads

Steps to connect to EC2 instance:

1. Go to AWS console.
2. Click on EC2, click on running instances link





3. Select the checkbox of EC2 you would like to connect to.
4. Click on Action. Copy the url from SSH which looks like below:
For e.g.
ssh -i "mykey.pem" ubuntu@dns_name.compute.amazonaws.com



For windows machine(and also for Mac))

1. Open Git bash
2. type pwd
It may print your directory in git bash
3. Now type cd downloads
4. make sure you have keys in the downloads directory by typing the below command:
ls *.pem

The above command should list all the pem files in the downloads directory.

Note: Only for Macbook pro laptops! 
You need to perform additional step to give read permissions for the *.pem file 
chmod 400 myJenkinsEc2KKey.pem. 

5. Now paste the url from step # 4 above
ssh -i "mykey.pem" ubuntu@dns_name.compute.amazonaws.com
type yes

6. now you should be in AWS cloud, screen should tell you something like this:

Last login: Sun month 18 19:01:21 2021 from 64.183.186.78
ubuntu@ip-172-31-26-96:~$

No comments:

Post a Comment

Introduction to continuous integration: Jenkins

  Jenkins setup - Install Java, Jenkins, Maven, Tomcat on Ubuntu EC2 - How to install Java, Jenkins, Maven, Tomcat on Ubuntu EC2 Please foll...