Google Compute Engine

Instance Is Not Desired Machine Type

Ensure that instances have desired machine type based on the requirements.

Risk Level: Medium

Description

This plugin ensures that Virtual Machine (VM) instances are of the desired type based on the appropriate requirements. All the Virtual Machines are categorized into different machine families. Each machine family has predefined machine shapes with specific configurations to fit a range of workloads. It is essential to use the right machine type for the VM instances to get optimal performance.

About the Service

Google Cloud Compute Engine:

Google Cloud Compute Engine is a service that allows you to create Virtual Machines based on your preferences and run them on Google’s infrastructure. You can either use their predefined machines with certain default configurations or create your own custom Virtual Machine to meet your exact requirements. To know more, read here

Impact

There are different types of Virtual Machine (VM) instances, each of which is best suited to specific workloads. Not using the desired machine type for your VM instance would affect the performance of the instance. Since the pricing of virtual machines is different based on the configurations, not using the desired machine type could also result in unwanted billing charges.

Steps to Reproduce

Using GCP Console-

  1. Log In to your GCP Console.
  2. From the top navigation bar, select the GCP project you want to investigate.
  3. From the navigation panel on the left side of the console, go to Compute Engine and select VM Instances. You can use this link (https://console.cloud.google.com/compute) to navigate directly if you’re already logged in.
  4. Select the VM instance you want to investigate from the list of instances and go to the Details tab to examine the details of the VM instance selected.
  5. Check the Machine type section for the details about the machine type of the selected VM instance.
  6. Repeat steps 4 and 5 for all the VM instances you want to investigate in the selected project.
  7. If you have multiple projects that you want to investigate, repeat steps 2-6 for each project in your GCP console.

Steps for Remediation

If the Virtual Machine (VM) instances are not of the desired machine type, follow the steps below to make the necessary changes.

Using GCP Console-

  1. Log In to your GCP Console.
  2. From the top navigation bar, select the GCP project you want to investigate.
  3. From the navigation panel on the left side of the console, go to Compute Engine and select VM Instances. You can use this link (https://console.cloud.google.com/compute)  to navigate directly.
  4. Choose the virtual machine (VM) instance you want to change the settings for select the STOP button from the top navigation bar and confirm the action in the confirmation box.
  5. Now, click on the EDIT button on the top navigation bar to edit the required configurations of the VM instance.
  6. In the Machine configuration section, choose the required machine family and select the desired Series and Machine type from the dropdown lists provided for the same. Click the Save button after making all the necessary changes.
  7. Select the START button from the top navigation bar and confirm the action in the confirmation box. This VM instance is now successfully using the new GCP service account you created.
  8. Repeat steps 4 to 7 for all the VM instances you want to reconfigure in the selected project.
  9. If you have multiple projects, repeat steps 2 to 8 for each project in your GCP console.