Need help?

How To Connect To AWS EC2 Ubuntu GUI Using PUTTY From The Windows Machine?

This article includes the steps of creating an Amazon AWS Ubuntu instance, setting up a desktop GUI via PUTTY, and connecting to it via Remote Desktop Connection.

So let’s get started,

We will start by creating an EC2 instance. Go to EC2 Console and Click on Launch instance. Where you will find multiple AMIs, Scroll down and select Ubuntu Server (For testing purpose select Free tier eligible).

Create-EC2Once you select the server, follow further steps, and launch. Make sure while launching download the PEM file as it will need in the future.

Now go to the EC2 dashboard and look for a public IP address and Copy that as we will need for PUTTY configuration, Though you can use Public DNS as well.


We are done with AWS configuration, now open PUTTY and follow a few steps:

  • Add copied IP address in the Host Name field and name the Saved session and save it. Will keep port as it is i.e., 22 as we have only opened the 22 port as we want everything should go through the SSH tunnel; though you can open other ports as well there will be less security.

Connect To AWS EC2 Ubuntu GUI Using PUTTY

  • Add SSH (PPK) key by browsing SSH -> Auth -> Private Key file for authentication -> Browse and again go to Session and Save it.
    Note: By default, AWS only provide a PEM file. We need to convert PEM to PPK. You can find multiple online tools for converting this.

Connect To AWS EC2 Ubuntu GUI Using PUTTY

  • Click on Open, and it will prompt a security alert just choose Yes, and you will able to see the command prompt.
    On the command prompt, just log in as Ubuntu, as we have added PPK so it won’t ask for Password.

Connect To AWS EC2 Ubuntu GUI Using PUTTY

  • Once you get logged into the server, you need to follow the below.
    • sudo apt update && sudo apt upgrade
    • sudo sed -i ‘s/^PasswordAuthentication no/PasswordAuthentication yes/’ /etc/ssh/sshd_config – To set login credentials
    • sudo /etc/init.d/ssh restart
    • sudo passwd ubuntu – This will be your login password to ubuntu machine
    • 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

Note: In between, if this process asks for some kind of choice, then select the local version installed option.

Now, we need to configure the tunnel on PUTTY to the route of the request.

Open PUTTY again and go to the Connection – > SSH -> Tunnels ->

  1. Add Source Port (This could be any in my case I have added 8888).
  2. Add Destination Port – This will be your instance private IP address following with 3389.
  3. Click on Add.

Connect To AWS EC2 Ubuntu GUI Using PUTTY

Once done, now click on the open button and you will see a Command prompt where login Id will be Ubuntu.
Now you can check either we are listening on the same port or not using the following command: netstat -antp

Connect To AWS EC2 Ubuntu GUI Using PUTTY

Now we are done with the setup.

Open Remote Desktop Connection

Add localhost:8888 or and Connect

Connect To AWS EC2 Ubuntu GUI Using PUTTY

You will be asked for a username and password; So username could be Ubuntu and Password will be added by you while installing the command. And Yeah, there you go, We have successfully logged into the Remote server.

We Keep Sharing Tips And Learnings On Growth And Technology. Join Our Popular Newsletter That Goes Out Once In 2 Weeks


Tech Expert

Deepak is a Full-stack developer with around 3 years of experience. He is an expert in building Java integrated web applications, Creating REST APIs with well designed, testable and efficient and optimized code. He is having experience in web technologies like AngularJS, Angular6, JavaScript, etc. He is a Lead developer at Codegrip. He loves to solve technical problems and helping others.

Get in touch for a detailed discussion.

What’s on your mind? Tell us a little bit about yourself and your question, and we will be in touch with you within 12 hours

Free eBook on Telemedicine Platform Development: All About Telemedicine

Download Free eBook Now!