How to connect to AWS EC2 Instance from Windows 10 and Linux

Hi all. Do you want to start with web development and/or developing Rest Full database? Maybe the AWS (Amazon Web Service) is good way to start. There are a lot of Amazon Services, but for this blog we are focusing on Amazon Elastic Compute Cloud or Amazon EC2 and how to connect to AWS EC2.

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers. Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment.

From Amazon (https://aws.amazon.com/ec2/)

You can host your website or have cloud PC with static IP address on AWS. But what you need to do to connect to your cloud PC from your local Windows 10 or Linux PC. So let’s begin, how to connect to Amazon EC2 Instance from Windows 10 and Linux.

There is couple of things to configure:

  • AWS EC2 from Amazon Dashboard
  • Windows 10 side
  • Linux side

Configure AWS EC2 from Amazon Dashboard

When initially creating EC2 Instance you were asked to create and download .pem file. This file is required for the rest of this tutorial. Now, I’m expecting that you have EC2 instance up and running, so that you just need to configure network part. Let’s open Amazon EC2 Dashboard.

AWS Dashboard
AWS EC2 Dashboard
  • Create Elastic IP
  • Assign Elastic IP to EC2 Instance
  • Configure Network Security group

Create Elastic IP

Network & Security section

Select Elastic IPs and then select Allocate Elastic IP Address.

Elastic IP Dashboard

Assign Elastic IP to EC2 Instance

Allocate one IPv4 from Amazon’s pool
Allocated IPv4 address

Now you have allocated IPv4 address, but this address isn’t linked to your EC2 Instance. That you can do with next steps.

Associate Elastic IP address

Then on the next windows from Instance filed select Instance that you want to link to your Elastic IP.

Configure Network Security group

Now you have Elastic IP linked to your Instance. Now you just need to check Security Groups are right port enabled? For ssh connection, which we want to achieve in this blog post we need port 22.

From AWS EC2 Dashboard check with security group is assigned to your running instance. You can click on that link or open tab Security Groups. From list select your Security Group and then check Inbound Rules.

Inbound Rule for SSH Connection

And now you are finished with AWS EC2 configuration and we can configure Windows and Linux side.

Configure Windows 10 Side

On Windows side we need programs that are Putty and PuttyGen. You can install then from next link:

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

First we need the generated .ppk file form .pem file and for that we need the PuttyGen program.

PuttyGen

Open PuttyGen and then click Load and then select your .pem. Then you can just click on Save private key to create .ppk file which you can use later with Putty. Now, we can open Putty.

Putty config 1

In Putty, we need to configure some options. First we need to check SSH in Connection type and then fill field Host Name with ubuntu@<your_elastic_ip> (example ubuntu@2.14.40.150). Ubuntu is default name for AWS EC2 with Ubuntu linux distro.

Putty config 2

Select Connection->SSH->Auth and then in Private key file for authentication field browse for the created .ppk file that we create before. Now, just return to Session tab to save this configuration by entering the name in Saved Session and click save. And you are up and running.

Connect form Windows 10 to AWS EC2 Instance

Configure Linux side

Configuration of Linux side is much simpler that on Windows. You just need .pem file. Simply open the terminal and you need to use ssh command.

ssh -i /path/key-pair.pem instance-user-name@elastic-ip

And that is it. So much simpler.

Finish

You are now set. You have working connection to AWS EC2 instance and you can start with your development work. This was simple and necessary setup when working with Amazon Web Services. And that is all on how to connect to AWS EC2 Instance from Windows 10 and Linux.

Please comment down bellow and please and check out my other post on:

https://bln364.com/

Leave a Comment