Getting Started with Google Compute Engine: Virtual Machines

InGoogle Compute Engine Icon my last post, I introduced you to the core concepts of Google Compute Engine. Like any other IaaS offering, VMs form the core of the platform. If you are serious about mastering GCE, you should focus on learning everything about Virtual Machines, which are also called Instances.

To launch a VM, you need to make the following choices:
• Region & Zone
• Machine Type
• Boot Source
• OS Type

When you use the Google Developer Console, you will find the screen similar to the following:

Location and resources screen Google Compute Engine
Region & Zone

Google Compute Engine allows you to choose the region and zone where certain resources live, giving you control over where your data is stored and used. Google Cloud Platform (GCP) resources are hosted in multiple locations worldwide. These locations are composed of regions and zones within those regions. Regions are the geographic locations where GCP resources are hosted. As on date, GCP is available in US-Central1, Europe-West1, and Asia-East1. Each region is further divided into isolated facilities called zones. Zones in a region provide isolation for many types of infrastructure, hardware, and software failures. Every region has at least 2 zones available for the customers. Putting resources in different zones in a region provides isolation for many types of infrastructure, hardware, and software failures. Putting resources in different regions provides an even higher degree of failure independence. When you expand the Zone dropdown list in the Google Developer Console, you will see the available regions and zones:

GCE Instance Metadata dropdown
For example, when you launch an instance in Europe-west1, you can choose to launch the instance in either Europe-west1-a or Europe-west1-b. You could then launch 2 instances that have better uptime and redundancy.

Machine Type

When do you deal with traditional infrastructure, you will assess the power of each server based on its CPU, RAM and storage capacity, later on, the same server can be upgraded to support better CPU, additional memory and storage. On GCE, the machine type influences the power of an instance. Machine types determine the physical specifications of the instances running in GCE, such as the amount of memory, virtual cores, and disk storage limits an instance will have. Currently, GCE supports a variety of machine types:

  • Standard machine types
  • High CPU machine types
  • High memory machine types
  • Small machine types

Standard machine types are suitable for most of the workloads including web applications, application servers, database servers, and backend tasks. High CPU machine types are ideal for compute-intensive tasks that require more virtual cores relative to memory while high memory instances are ideal for tasks that require more memory relative to virtual cores. Small machine types are more cost-effective for running small, non-resource intensive applications than standard, high-memory or high-CPU instance types. You can select the right machine type from the Google Developer Console.

Boot Source

Each instance is backed by a persistent disk that has a bootable root file system. Technically, when you launch an instance, GCE first creates a disk and then attaches that to a VM before booting it up. This disk can come from a variety of sources. If you choose a new disk, that will be a read-write replica of a special disk called image. The boot source can also be an existing disk that was used to boot an instance.

Since GCE doesn’t support temporarily stopping and starting the instances, the instance can be deleted while retaining the boot disk. Later on, the same disk can be used to launch a new instance that contains all the configuration of the original instance. Finally, the boot source can be pointed to an existing snapshot. A snapshot is a point-in-time backup of a persistent disk. If you want quickly clone a running instance with minimal downtime, you can take a snapshot of the boot disk and use that to launch another identical instance. This is a flexible yet powerful way to launch symmetrical instances in a short span of time. Google Developer Console makes it easy to choose the right option. (The next post discusses the concepts of persistent disks and snapshots in-depth. Stay tuned).


OS Type

If you choose to boot your instance from a new disk, then you have to choose the right image. As discussed above, an image is a persistent disk that contains a bootable operating system and root file system. As on date, GCE supports the following operating systems:
• Debian Linux
• CentOS Linux
• SUSE Enterprise Linux
• Red Hat Enterprise Linux
• Microsoft Windows Server

Debian and CentOS are the generic open source operating systems while SUSE, RHEL and Windows Servers images are considered to be premier operating systems that are charged slightly more than the other open source OS images.

In this post, you learned about the key parameters required to launch a GCE instance. In the next post, I will introduce persistent disks and snapshots that form one of the key building blocks of GCE.

Cloud Academy