Monday, April 13, 2020

running Visual Studio 19 VM on Google Cloud Platform

Microsoft offers free Windows 10 90 day trial virtual machines for Edge and a larger Enterprise virtual machine set with Visual Studio, 60 day trial. To run these virtual machines, a computer with 100 GB or more free space, 2 or 4 CPU cores, 8 or 16 GB RAM etc would be good. In fact, the Visual Studio VMs are 20 GB downloads which take up more than 40 GB in use. So, those of us with low-end machines would be frustrated if we tried to use them - on external drives and so on - with slooow performance due to lack of RAM and slow disks. This is where cloud server free trials help. Earlier I had written about Microsoft's Azure free trial, this post is about Google Cloud Platform (GCP).

The one year free trial needs a fresh google account and a credit/debit card (in India), and gives you one year / $300 credits. 4-5 hours of work yesterday on a dual-core 8 GB VM cost me around $1.

Windows Server images are not available under the free trial credits. If you want to run Windows, you have to run it as a nested VM - a VM under a VM. Nested VM support on Google Cloud Platform has some restrictions - otherwise virtualbox complains that VT-X is not available. But the image I created worked - the Microsoft Virtualbox VM download, running on Ubuntu 18.04 obtained from GCP. The procedure I followed to get nested VMs working was basically this. Instead of downloading and installing the gcloud sdk, we can directly run the cloud shell from a browser, especially Chrome. With the following caveats for Windows nested VMs.

  1. sudo worked only for the ssh in browser window (without asking for any password) which could be opened from GCP. On the ssh opened in a terminal window on my local machine, it asked for user's password (which I did not know. Is it the same as the google account  password?). This ssh session was opened with manually copied ssh keys. So, just use the SSH from browser window.
     
  2. install the latest virtualbox - the downloaded image needs Virtualbox 6 and will not work with the default Virtualbox 5 installation from Ubuntu 18.04. If you are uninstalling Virtualbox 5 and installing Virtualbox 6, you need to sudo apt-get remove virtualbox-dkms also
  3. increase size of disk to 150 GB and change the machine type to have more RAM. This can be done with the Edit button in the VM instances page of GCP. If disk is too small, virtualbox complains of "invalid argument" and crashes. Plan for free disk space 3x the size of the downloaded image at the very minimum.
  4. I followed these instructions for setting up VNC, with the default local client Remmina. My preferred desktop was Cinnamon, but it kept crashing. Maybe because I did not edit the startup script. Then tried xfce. But the panel doesn't work, in spite of these instructions. But I can right-click to get a menu and run applications on the desktop.
Edit - I've now added a post on GCP running costs.

No comments:

Post a Comment