Monday, May 6, 2019

How to connect to an EC2 instance from Windows or IMac?

Pre-requisites:

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 iMac))

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:
  dir  *.pem

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

only for Macbook pro laptops, you need to perform additional step
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 2018 from 64.183.186.78
ubuntu@ip-172-31-26-96:~$

No comments:

Post a Comment

Automate Azure App Service setup using Ansible and Azure DevOps pipeline | How to integrate Ansible with Azure DevOps | How to Create WebApp in Azure Cloud using Ansible

Ansible is an open-source, configuration management tool that automates cloud provisioning, configuration management, and application deploy...