If you’re looking for a cost-effective way to run your workloads on Google Cloud Platform, you may want to consider using preemptible or spot VMs. Preemptible VMs can be interrupted by Google with only short notice, so they’re ideal for workloads that can tolerate interruptions. Spot VMs are offered at a discount compared to on-demand VMs, so they’re a great option if you’re budget-conscious. In this post, I will dive into what preemptible and spot VMs are and how they can benefit your organization.

Note – Please bookmark this below page to access all posts regarding Google Cloud Digital Leader certification.

Google Cloud Digital Leader Certification Notes

Read this blog post or watch the video below to learn how to create Preemptible and Spot Virtual Machine in the Google Cloud Platform.

What Is Preemptible Virtual Machine

Preemptible VMs in Google Cloud Platform (GCP) offers a cost-effective option for workloads that are able to tolerate the possibility of being interrupted. These VMs are typically available at a discount of up to 80% compared to standard on-demand instances, making them an attractive choice for cost-conscious organizations. 

Preemptible VMs are short-lived compute instances that are available at a lower price than standard on-demand instances. They are designed for workloads that are able to tolerate being interrupted and can be terminated by GCP at any time. Preemptible VMs are an ideal choice for batch processing jobs, data processing, and other types of workloads that are not time-sensitive.

One important thing to note is that preemptible VMs are not suitable for all workloads. They should not be used for applications that require a high level of availability or for workloads that are sensitive to data loss. Additionally, preemptible VMs are not eligible for the GCP Service Level Agreement (SLA), so it is important to consider the potential impact of an interruption before using them.

How To Save Costs With Preemptible Virtual Machine

Preemptible VMs can help you save costs in GCP in several ways:

  1. Discounted pricing: As mentioned earlier, preemptible VMs are available at a discount of up to 80% compared to standard on-demand instances. This can significantly reduce your compute costs in GCP.
  2. Flexibility: Preemptible VMs can be terminated at any time, which allows you to scale your compute capacity up and down as needed. This flexibility can help you avoid overprovisioning and save on costs.
  3. Batch processing: Preemptible VMs are well-suited for batch processing jobs, which can help you save on costs by allowing you to process large amounts of data in parallel.
  4. Spot instances: Preemptible VMs are similar to Amazon Web Services’ (AWS) spot instances, which allow you to bid on spare compute capacity. If the price you bid is higher than the current spot price, your preemptible VMs will be created and run until either your specified maximum price is reached or the VMs are terminated by GCP.

Tips For Using Preemptible Virtual Machine

Here are a few tips for using preemptible VMs effectively:

  1. Use preemptible VMs for workloads that can tolerate being interrupted: As mentioned earlier, preemptible VMs should not be used for workloads that require a high level of availability or are sensitive to data loss.
  2. Use fault tolerance techniques: To ensure that your workloads can recover from an interruption, you should consider using fault tolerance techniques such as replicating your data or using a tool like Google Cloud’s Managed Instance Group (MIG) to automatically recreate your VMs if they are terminated.
  3. Use automation: To take full advantage of preemptible VMs, you should consider using automation to scale your compute capacity up and down based on demand. This can help you take advantage of the discounted pricing and ensure that you are only paying for the compute resources you need.

Things To Remember While Using Preemptible Virtual Machine

There are couple of things you should remember while using Preemptible Virtual Machine and they are –

  1. It is a short-lived and cheaper virtual machine. It can run only for 24 hours.
  2. Google Cloud Platform can stop the instance any point of time and you will get only 30 seconds of warning before closure so that you can save your work.
  3. There are some restrictions associated –
    1. Preemptible Virtual Machines are not always available.
    2. You can not use Google Tier Free Credit to create this virtual machine.
    3. No automatic restarts are available.
    4. These virtual machines are not covered by any Service Level Agreement and are excluded from the Compute Engine SLA. 

What Is Spot Virtual Machine

Google Cloud Platform (GCP) offers a variety of services for running virtual machines (VMs) in the cloud, including the ability to create and manage Spot VMs.

Spot VMs are a cost-effective option for running workloads that can tolerate interruptions. They are available at a significant discount compared to on-demand VMs, and are ideal for batch jobs, big data processing, and other workloads that can be interrupted without loss of data.

Spot VMs are created using the same process as on-demand VMs, with the added option to specify a maximum bid price. This bid price is the most you are willing to pay for the Spot VM, and it will be terminated if the spot price exceeds this bid price.

One of the key benefits of Spot VMs is that they allow you to take advantage of spare capacity in the GCP infrastructure, resulting in cost savings of up to 90% compared to on-demand VMs. This is because the Spot market price fluctuates based on supply and demand, and when the demand for Spot VMs is low, the price drops, allowing you to get the same resources at a lower cost.

Additionally, Spot VMs offer a high level of flexibility and scalability, as you can easily scale your workloads up or down as needed. You can also use GCP’s autoscaling feature to automatically scale your Spot VM instances based on your workload needs.

Spot VMs can be managed through the GCP Console, the gcloud command-line tool, or through the GCP API. Additionally, GCP provides several pre-configured images for running popular workloads, such as Apache Hadoop and Apache Spark, on Spot VMs.

What Is The Difference Between Spot & Preemptible Virtual Machine

Spot Virtual Machines are the latest version of Preemptible Virtual Machines. However, Spot Virtual Machines provide new features that Preemptible Virtual Machines do not support.

Unlike Preemptible Virtual Machine, Sport Virtual Machine doesn’t have any runtime restrictions like 24 hours. It can run any number of hours.

Rest all features are same.

To create a Preemptible Virtual Machine, you need to use either gcloud CLI or Compute Engine API. But you can create Spot Virtual Machine from Google Cloud Console.

Steps To Create Spot Virtual Machine

To create Spot Virtual Machine, first, you need to go to Compute Engine -> VM instances. From there, you need to click on “Create Instance” button.

In the next screen, expand the Advanced options and then expand the Management section. You will find the option Spot under VM provisioning model. Below is the screenshot

Conclusion

In conclusion, Preemptible VMs and Spot VMs both provide cost-saving advantages for GCP users. Preemptible VMs are best suited for non-time-sensitive workloads that can take advantage of their lower per-hour cost. Spot VMs provide a cost-effective option for running workloads that can tolerate interruptions without impacting your performance or end-user experience. By understanding when to use these options, you can get the most out of GCP and save time and money in the process. Are you ready to reap the benefits of Preemptible and Spot VMs? Start exploring today!

Disclaimer

This article is not endorsed by Salesforce, Google, or any other company in any way. I shared my knowledge on this topic in this blog post. Please always refer to Official Documentation for the latest information.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *