Recently I had a project that required a GUI and wanted it to run automatically in the cloud. Initially, I considered using a Windows instance, but found that even downloading a browser was very slow. As a free AWS user, I could only use the command-line-only Ubuntu Server. Then I had a spontaneous idea: what if I could install a GUI on Ubuntu Server? I looked it up and the method seemed feasible (though ultimately it’s not very practical - I’ve decided to stop tinkering with it, but I did manage to install a GUI successfully).

  • Install and enable xrdp. A remote desktop system is needed for GUI, and xrdp is the Linux client:

    sudo apt-get update
    sudo apt install xrdp -y
    sudo systemctl enable xrdp
    
  • I first tried GNOME, but discovered it consumed too many resources. Free tier users would likely experience the same lag as on Windows:

    sudo add-apt-repository ppa:gnome3-team/gnome3
    sudo apt-get install gnome-shell ubuntu-gnome-desktop
    
  • Later, I decided to try the more lightweight XFCE:

    apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils -y
    adduser xrdp ssl-cert
    systemctl restart xrdp
    
  • Set a password (required for AWS):

    sudo passwd ubuntu
    
  • In the EC2 Security group, select Allow All Traffic:

    Allow all Traffic

  • Download Windows App from the App Store on your MacBook. This is a remote desktop application developed by Microsoft, and I have to say their software for Mac is really excellent:

    Windows App

  • Select “Add a PC”. For the computer field, enter the AWS-provided DNS. The username is typically “ubuntu”, and the password is the one you set earlier.

  • After that, you can connect:

    XFCE

However, even though XFCE is already very lightweight, I found it sluggish after downloading Chrome, so I gave up on this approach. I don’t recommend this method for AWS free tier users.