Azure vs GCP part 11: Virtual Machine (GCP)
Tags: azure, gcp, cloud
Published: 2018-03-13 16:35:41

---
title: "Azure vs GCP part 11: Virtual Machine (GCP)"
published: true
description: In this series, I compare Azure and GCP as C# developer
tags: azure,gcp,cloud
cover_image: https://thepracticaldev.s3.amazonaws.com/i/m57mmv4hgz9xrskaital.PNG
---

I tried Azure VM from application deployment views in last couple of articles. Now I do the same on GCP.

# Google Compute Engine (GCE)
Though it's Google Cloud, it supports [windows](https://cloud.google.com/compute/docs/instances/windows/) and Linux OS, with/without applications. I use full .NET application to try this Windows environment.

### Types
Types is Size in Azure, and see [this article](https://cloud.google.com/compute/docs/machine-types) for detail, but there are many purpose oriented size choices are available, such as High-CPU types, High/Mega-Memory types, and GPU, etc.

### Regions/Zones and Price
There are tons of locations you can choose from and many pricing options to optimize the cost. As this is not marketing blog, I don't explain the detail. Check out [Available regions and zone](https://cloud.google.com/compute/docs/regions-zones/) and [Pricing](https://cloud.google.com/compute/pricing)

### Other features
Same as Azure I really cannot list all the features, but you shall find what you need for most purpose, such as:

- SSD
- Persistent Disk
- Load balancing and Scaling
- IAM
- VM Management
- Monitoring
- Integration with other services
- Automation
- Tools
- Customization, etc.

# Let's try

I use Full .NET application to test this out, as Visual Studio integration recognize it and let me use Windows image for VM.

### Provision VM

I can deploy clean Windows Server and install IIS, ASP.NET or any other dependency by myself. Or, I can use an image with these dependencies installed by default. This time I use pre-configured image for ASP.NET.

1\. Go to [Cloud console](https://console.cloud.google.com/) and select "Cloud Launcher" from menu.

![vm](https://thepracticaldev.s3.amazonaws.com/i/czx5mwqzu4ubuemkr4vd.PNG)

2\. Search "ASP.NET" and select "ASP.NET Framework" image.

![vm](https://thepracticaldev.s3.amazonaws.com/i/sqaaay1p5i0l8orqliqj.PNG)

3\. Click "Launch on compute engine".

![vm](https://thepracticaldev.s3.amazonaws.com/i/0wj4j1t8e2f0bedi4gvl.PNG)

4\. Enter required field. Make sure you enable HTTP port and WebDeploy for firewall. Then click "OK".

![vm](https://thepracticaldev.s3.amazonaws.com/i/uognkoxw0komsaewz92b.PNG)

5\. Deployment Manager shows the progress. Wait until the deployment completed. This may take a bit of time.

![vm](https://thepracticaldev.s3.amazonaws.com/i/k7xl5mm4tsf1bdysgpm5.PNG)

That's all for deploying VM.

### Create an application and deploy.

1\. Open Visual Studio 2017 and create new project. Select ASP.NET Web Application (.NET Framework). 

![app](https://thepracticaldev.s3.amazonaws.com/i/m01atwtmjjot347os83a.PNG)

2\. Select Web API template and click OK. This template already include API, so I just use it.

![app](https://thepracticaldev.s3.amazonaws.com/i/r8bxnsg97sormo76xard.PNG)

3\. Right click the project and click "Publish to Google Cloud".

![app](https://thepracticaldev.s3.amazonaws.com/i/fmhi6wgx4spg2mov2sb6.PNG)

4\. Select "Compute Engine".

![app](https://thepracticaldev.s3.amazonaws.com/i/f2shsptqjkiz1sfeqksg.PNG)

5\. Select the VM you want to deploy to, and click "Manage Windows credential".

![app](https://thepracticaldev.s3.amazonaws.com/i/8nwkaob15tskvhx1rsrd.PNG)

6\. Click "Add credentials" and add new user. enter VM administrator's username and password. In my case, I let the wizard generate new password. It will show you the password later. Close the window.

![app](https://thepracticaldev.s3.amazonaws.com/i/sgbgpa3rdpgb9ocfkp44.PNG)

7\. Click "Publish".

![app](https://thepracticaldev.s3.amazonaws.com/i/0328dppumdfk13byrw8o.PNG)

8\. Wait until deploy complete. Once completed, go to "/api/values" to see it returns result.

![app](https://thepracticaldev.s3.amazonaws.com/i/038pvgacmd7blhlyvpjo.PNG)

# Tips
Unlike Azure, create the VM from template didn't create virtual network, but GCP prepare network settings by default.

### Virtual Private Cloud (VPC) netrowk
According to [this document](https://cloud.google.com/vpc/docs/overview), VPC network is

>You can think of a VPC network the same way you'd think of a physical network, except that it is virtualized within GCP. A VPC network consists of virtual local subnet networks in data centers, all connected by a global wide area network. Networks are logically isolated from all other networks in GCP.

1\. From menu, select VPC Network | VPC networks.

2\. Check IP addresses ranges for Region where the VM is deployed.

![vpc](https://thepracticaldev.s3.amazonaws.com/i/rzgtk7o202dqhuwry005.PNG)

3\. Go to Compute Engine to see the internal IP of the VM.

![vpc](https://thepracticaldev.s3.amazonaws.com/i/ydotb8pktked0yvq9jzz.PNG)

### Firewall Rules
Firewall Rules specified when provisioning the VM goes to Firewall rules section in VPC Network.

![fw](https://thepracticaldev.s3.amazonaws.com/i/zn7tnz37ku8o8vsk96z7.PNG)

### External IP
You can find created External IP in External IP addresses.

![ex](https://thepracticaldev.s3.amazonaws.com/i/42w8m8nwz5skad9lsfzr.PNG)

### Backup
GCE provides "Snapshot" feature to backup the VM.

1\. Go to "Compute Engine" | "Snapshots". Click "Create snapshot.

![back](https://thepracticaldev.s3.amazonaws.com/i/v0gxznbucax58ud7cb1x.PNG)

2\. Specify options and click "Create".

In the next article, I will look into how to scale VM environment.

Ken