Intro to GCP Compute Engine

If you’re a Windows .NET developer, then when you think cloud, your first thought is probably Microsoft Azure. However, Google Cloud Platform (GCP) has a very strong offering for Windows developers as well, starting with one of the most fundamental building blocks of cloud computing: the Virtual Machine (VM). The Google Cloud Platform’s name for VMs in the cloud is Compute Engine. It might be intimidating to step into an arena largely populated by unfamiliar Linux servers and enough foreign programming languages to populate a veritable Tower of Babel, but let me reassure you: working with Windows Server VMs in GCP is extremely friendly and approachable. In this tour, I’ll act as your friendly guide to show you some of the things that I like and appreciate about the VM management experience in GCP. Just so you know where I’m coming from: I’m happier and more comfortable writing code than wrangling infrastructure, so if I can find things to love about managing VMs in GCP, then I bet you can too.

Creating Windows Server VMs

There are two main ways to create a new VM in GCP: by creating a new instance from the Compute Engine | VM Instances tab, or by using the Cloud Launcher. The difference here is that the Cloud Launcher offers a catalog of preconfigured VM images with additional software installed, whereas creating a new VM instance in the Compute Engine tab will get you a VM with nothing more than the selected OS installed.

Creating an Empty VM

For ASP.NET development, it will generally be more convenient to use the Cloud Launcher to take advantage of the pre-configured images, but let’s take a quick look at creating a plain VM first.

Here you can see the basic options available. The machine type dropdown actually controls both vCPU and memory in lockstep, but you can create custom combinations of CPU and memory if you desire. Below that is the boot disk configuration where you choose operating system, disk type (standard or SSD) and disk size. Finally, to the right is a terrific itemized breakdown of the cost, so you can quickly and interactively see how the options you choose affect the price. Lastly, I want to call attention to this little nugget at the bottom because it’s easy to miss and yet so appreciated.

After you interactively configure a VM, you can click these links to get a modal window that contains the exact REST or gcloud command so you can automate creation of identical VMs in the future. You’ll find thoughtful little concessions like this sprinkled throughout the GCP UI.

At this point you can click Create to provision a brand-new Windows Server with nothing installed.

Creating an ASP.NET VM with Cloud Launcher

Now let’s take a look at what you get by using the Cloud Launcher to create an ASP.NET VM. Cloud Launcher will both create a VM with the configuration you specify, and also customize that VM with additional software and configurations. Right now, you can find the image in the Cloud Launcher just by searching for “asp”.

As you can see in the text on the card, this image includes IIS and ASP.NET. The inclusion of SQL Express is simply to make it easy to get started with ASP.NET in GCP, because obviously you can’t and won’t scale an app without a common database–at least in most cases. Clicking on the card will bring up a more complete set of information including a pricing projection based on the default configuration. Unfortunately, if you choose to customize the image before creation, you won’t get to see an updated pricing projection like you can with the Compute Engine UI. I’ll create one with the default configuration so you can see how to manage one of these VMs.

Managing Windows VMs in the Google Cloud

Whether you create a bare Windows Server instance or use the Cloud Launcher, you will end up in the Deployment Manager. On the right side of the page, just under the instance info, there is a button with a dropdown button on it.

Available options are:

  • RDP
  • Create/reset password
  • Show gcloud command to reset password
  • Download RDP file

The first thing you should do is actually create a Windows password. See how once again the UI shows you how to automate this task? I love that! Once you create a Windows password, you can manage the instance remotely. The two main options available are “RDP” and “Download the RDP file”. The first option will launch a browser-based RDP session, while the second will download a file that contains all the info you need to connect with your local, native RDP client. This is not the only place where a browser-based alternative is available; every GCP account can also launch a browser-based terminal session with a Linux-based environment with many essential developer tools pre-installed and a persistent home directory. You could in theory do all your work on a Chromebook! I mean, you probably wouldn’t, but it’s still nice.

Once you’re at the point where you can connect with RDP to the VM, it’s just like managing any other Windows Server. I’ll write separately about my experience migrating an ASP.NET web application from Azure App Services to a VM in GCP.

The following two tabs change content below.

Adam Anderson

Master Consultant at Falafel Software
Adam Anderson is a Microsoft Certified Solution Developer with over 20 years of experience. He started as a consultant using Delphi to rapidly deliver custom, high-quality database applications in a wide variety of industries. Over the course of his career, he has acquired a wide variety of skills including database design, query and index optimization; Database metaprogramming and databases with dynamic, self-modifying schemas; reporting with Crystal Reports, SQL Reporting Services, and Telerik Reporting; .NET Framework, ASP.NET MVC and Web API; ServiceStack; LINQ and Entity Framework; HTML, CSS, and Javascript; Kendo UI; Regular expressions; and lately, Node.js, Express, Angular, MongoDB, PostgreSQL, Redis, Windows Azure, AWS, and more. Fortunately, Adam likes learning new things and then writing about them!