Google Cloud VMs
Google Cloud VMs

All About Google Cloud VMs: GCP ACE Exam in 2025

Google Cloud VMs are a important part of cloud infrastructure, offering flexible, scalable, and customizable solutions for various workloads. This blog will provide you with in-depth knowledge about Google Cloud VMs. It focuses on essential concepts, tools, and strategies. These insights will help you optimize usage and reduce costs. Also this blog will be helpful for preparing Google Cloud Associate Cloud Engineer certification(google ace exam)

Why Choose Google Cloud VMs?

Google Cloud VMs provide a high-performance and cost-effective solution for deploying and managing applications. You might be running a small web application. Or you could be handling large-scale machine learning tasks. Google Cloud offers the flexibility to configure VMs precisely for your workload requirements.

Instance Templates: Simplify VM Creation

Specifying VM details like machine type, image, and disk configuration manually can be tedious. It is error-prone to do this each time you create a VM.

Instance templates are pre-configured templates that simplify the creation of VMs and managed instance groups. They allow you to define:

  • Machine type
  • Image
  • Labels
  • Startup scripts
  • Other properties

Key Benefits:

  • Convenience: Quickly create similar instances without manual reconfiguration.
  • Consistency: Ensures uniformity across VMs.
  • Limitations: Instance templates cannot be updated. To make changes, copy an existing template, modify it, and save it as a new template.

Optional Feature: You can specify an image family (e.g., debian-9) to automatically use the latest non-deprecated version.

Steps to create Instance template

  1. Login to Google cloud console
  2. In the search bar type Compute Engine
  3. Then click on Instance templates
  4. Give a name to the template
  5. Set the machine type and start-up script and click of create
Google Cloud VMs

Custom Images: Increase VM Launch Time

Installing operating system patches and software at VM launch can significantly increase boot times. Also company wide security changes can be deployed in the custom image by hardening the image.

Custom images are pre-configured VM images or hardened images that include OS patches and software, allowing VMs to boot quickly and securely.

Key Features:

  • Source Options: Create custom images from instances, persistent disks, snapshots, other images, or files in Cloud Storage.
  • Shareability: Custom images can be shared across projects
  • Security: Harden custom images to align with corporate security standards.

Recommendation: Prefer using custom images over start-up scripts for better efficiency.

Steps to create custom images

NOTE: Make sure that VM is in stopped state before following the below steps

  1. Launch a VM with all the custom software and other security hardening settings installed.
  2. Click on the Disks option
  3. Then select the disk of the instance for which you want to create the custom image.
  4. Now fill the details like custom image name
  5. Select the VM disk from which you want to create the custom image
  6. Click on Create button to create the custom image.

Google Cloud VMs
Google Cloud VMs

Google Cloud VMs

Ways for Cost Optimization

1. Sustained Use Discounts

Google Cloud automatically applies discounts when you run VM instances for a significant portion of the billing month. For example:

  • Discount Range: 20%–50% based on usage.
  • Applicability: N1 and N2 machine types, as well as instances created by Compute Engine and Kubernetes Engine.

Note: These discounts do not apply to E2 and A2 machine types or VMs created by App Engine flexible or Dataflow.

2. Committed Use Discounts

For predictable workloads, commit to a specific amount of resources for 1 or 3 years to receive up to a 70% discount.

Key Details:

  • Ideal for stable workloads with consistent resource needs.
  • Not applicable to VMs created by App Engine flexible or Dataflow.

3. Preemptible VMs

Preemptible VMs are short-lived, cost-effective compute instances with up to 80% lower costs. They are ideal for fault-tolerant, non-immediate workloads such as batch processing jobs.

Key Characteristics:

  • Maximum runtime of 24 hours.
  • Can be preempted by Google Cloud with a 30-second warning.
  • No SLA, automatic restarts, or migration to regular VMs.

4. Spot VMs

Spot VMs are the latest iteration of preemptible VMs same like spot instances of AWS cloud, offering dynamic pricing with discounts of 60%–91% compared to on-demand VMs. Unlike preemptible VMs, they have no maximum runtime.

Similarities to Preemptible VMs:

  • Can be reclaimed with a 30-second notice.
  • Not always available.
  • No Free Tier credits applicable.

Steps to create spot VMs

  1. Click on create instance
  2. Then on the left click on Advanced
  3. On the right you can see Provisioning model there select the Spot option
  4. Then click on Create to launch the VM.
Google Cloud VMs
Google Cloud VMs

Compute Engine Billing Insights

Google Cloud’s billing model is highly flexible:

  • Per-second billing: Billed after the first minute.
  • Stopped instances: Not billed for compute but billed for attached storage.

Recommendation: Always create budget alerts and use budget exports to monitor costs effectively.

Steps to create budget alerts in billing section

  1. Click on top right and then click on Billing
  2. Then in the create budget alert set the amount and click create

Set Billing
Google Cloud VMs
Set budget alert
Google Cloud VMs

Enhance Availability with Live Migration and Availability Policies

Google Cloud ensures high availability during host maintenance through live migration. Running instances are moved to another host without downtime.

Availability Policy Configuration:

  • Migrate (Default): Automatically migrate instances during maintenance.
  • Terminate: Stop instances instead.
  • Automatic Restart: Automatically restart VMs terminated due to hardware failures or maintenance.

Limitations:

  • Live migration is not supported for GPUs and preemptible instances.

Custom Machine Types: Set according to your requirements

When predefined machine types don’t meet your requirements, you can create a Custom Machine Type by configuring:

  • vCPUs
  • Memory
  • GPUs

For example if you have AI/ML application or memory-intensive database or application then custom machine type is very helpful.

  • AI/ML tasks
  • Memory-intensive databases
  • Graphics rendering

Custom machine types are billed based on the number of vCPUs and the amount of memory provisioned.

Best Practices for Google Cloud VMs

  1. Distribute Instances: Use multiple zones and regions for high availability.
  2. Choose the Right Machine Type: Optimize costs and performance by experimenting with different configurations.
  3. Use GPUs: For AI/ML workloads requiring intensive computation.
  4. Commit to Discounts: Utilize committed use discounts for predictable workloads.
  5. Leverage Preemptible/Spot VMs: Use for cost-sensitive, fault-tolerant workloads.
  6. Monitor with Labels: Organize resources by tagging VMs with labels for easy tracking and management.

Google Cloud VMs provide a robust, flexible, and cost-effective solution for diverse workloads. By leveraging tools like instance templates, custom images, and various discount schemes, you can optimize performance while minimizing costs.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply