Connect To EC2 Machine Remotely From Your Windows Machine

Lijoy C George
2 min readApr 30, 2021

This story talks bout how to establish remote connection to EC2 machine from your windows machine using windows remote desktop connection.

Remote connection to EC2

Create an EC2 Machine

If you are new to AWS EC2 resource, Please refer the link to know how to create and launch EC2 instance in AWS.

Connect To EC2 Machine

If you are looking for how to establish the connection to EC2 machine from your windows machine please refer the link.

Setting your Machine ready

Update the package sources list to get the latest list of available packages in the repositories.

sudo apt update

Update all the packages presently installed in our Linux system to their latest versions.

sudo apt upgrade

Enable password authentication and set password

sudo sed -i ‘s/PasswordAuthentication no/PasswordAuthentication yes/’ /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
sudo passwd ubuntu

Install Remote Desktop Protocol server

sudo apt install xrdp xfce4 xfce4-goodies tightvncserver
echo xfce4-session> /home/ubuntu/.xsession
sudo cp /home/ubuntu/.xsession /etc/skel
sudo sed -i ‘0,/-1/s//ask-1/’ /etc/xrdp/xrdp.ini
sudo service xrdp restart
Select Display manager ( Prompt will appears during your installation )

XRDP

It is an open source Remote Desktop Protocol server. XRDP uses Remote Desktop Protocol to connect to a remote computer with a GUI for the user. Xrdp is the main server which is accepting connection from RDP client through port 3389. The Xrdp contains RDP, security, MCS, ISO, TCP layers, and a simple window manager.

Setup tunnel in puTTY

Step 1: Got to puTTY->SSH-> tunnel
Update source port any like 8080
Step 2: Give instance private ip:3389
Step 3: Save session and open connection

Setup tunnel in puTTY

Connect to EC2

Open remote connection put IP 127.0.0.1:8080
Give username and password

Connect to EC2

--

--