If you’re going to work 100% remotely or are just tired of carrying a heavy laptop while commuting, why not spin up a DevOps Desktop PC in a public cloud and work from anywhere you want? So, if you like the idea, this post for you. In this post I’ll explain you how to build your own Remote DevOps Desktop on AWS and configure your thinner Local PC to connect to remote one.
This article uses Terraform to provision a cheap AWS EC2 Spot instance. The approximate cost will be less of 10 euros/month for a
m1.small instance located in
us-east-1 region. Also I’ll share the Github repository with all Terraform scripts where you will be able to change the configuration.
You have to clone the Affordable Remote DevOps Desktop and run through all steps explained there. Next a compacted list of commands:
$ git clone https://github.com/chilcano/affordable-remote-desktop $ cd affordable-remote-desktop $ terraform init $ terraform plan \ -var devenv_name="cheapdevops" \ -var ssh_key="remotedevenv" \ -var developer_cidr_blocks="126.96.36.199/32" $ terraform apply \ -var devenv_name="cheapdevops" \ -var ssh_key="remotedevenv" \ -var developer_cidr_blocks="188.8.131.52/32"
After a few minutes, you will be able to connect to your remote DevOps Desktop through SSH.
$ ssh ubuntu@$(terraform output remotedevenv_fqdn) -i ~/.ssh/remotedevenv
Software installed in the remote DevOps Desktop
In the moment of writting this post, the software base and tools installed are:
- Ubuntu 18.04 server (
- XFCE4 Desktop
- EC2 Spot Instance
|2) VS Code||Yes||1.43.2|
|4) AWS CLI||Yes||1.14.44|
Why XFCE4 and X2Go?
The answer is simple, XFCE4 is a lightweight Linux Desktop Environment and works flawlessly so far with X2Go. X2Go is a X-windows remote access software that has clients for Windows, Mac, and Linux and provides the best performance compared to X11 - X Window System, VNC and XRDP (X-windows version of the Windows Remote Desktop Protocol).
Things to improve
Instead of using a standard Ubuntu AMI, prepare a custom AMI with pre-installed XFCE4 and X2Go (getting this EC2 instance created takes 25 minutes!), and moving all DevOps Tooling installation to other separate script.(see post part2)
- Use Ansible instead of Bash script to provision the DevOps tools such as VS Code, Java, Terraform, Git, etc.
- Backup and restoring of critical, sensitive information and custom configuration into AWS S3 or X2Go capabilities to mount remote disks over SSH.
- Vertical Autoscaling (increase RAM, CPU or change type of instance).
- Metrics (performance when using ADSL, WAN, 4G, etc.)
Connecting to the remote DevOps Desktop
Below some screenshots if you want to know how looks like in Ubuntu 19.10 and if you want configure your X2Go Client. Before lets get the FQDN of your EC2 instance.
chilcano@inti:~/git-repos/affordable-remote-desktop$ terraform output remotedevenv_fqdn ec2-100-26-48-80.compute-1.amazonaws.com
And finally here below the Remote DevOps Desktop.
And here the configuration of a great feature: Sharing files between local and remote instance over SSH using X2Go Client.
- AWS EC2 Spot is still the cheaper Public Cloud resource in the market, although you could get cheaper one in Digital Ocean and Google Cloud.
- XFCE4 and X2Go, one is lightweight and the other is faster. Although there are not good X2Go client for iOS, both together are still the best option.
- Creating an EC2 Spot instance with XFCE4 and X2Go takes around 20 minutes and that is not good from the developer experience point of view and neither resilience point of view. The idea is to provide an OS bundle (AMI) that has, as a minimum, XFCE4 and X2Go already pre-installed.
- Backup and restoration is very important if we are using ephemeral resources, its implementation is considered as a critical functionality and is included in this project, and it will be implemented using AWS S3 or simply X2Go and its ability to sync files remotely over SSH .