When to use GCP — preemptible Instance

Kesavan.P
3 min readAug 15, 2020

--

Public cloud vendors offer organizations unlimited scalability and lower IT costs by only charging for the resources you use, but the truth about is that cloud customers are charged for the resources they order, whether they use them or not. If your cloud account has mismathced resources ,high reservations end of the month you will see bill-shock .

Lets dive into How Google Cloud Platform’s — Preemptiable instances helps reducing your cloud cost and when to use it.

credits: devops.com

GCP-preemptible instances are a type of virtual machine that you can create and run at a much lower price than normal instances.

How is it different :

  • The traditional VM instances types are long-running servers that are only shut down when you say so.
  • But, the preemptible VMs are short-lived precisely they do not last any longer than 24 hours and can be stopped on a moment’s notice.
  • Preemptible VMs can bring in huge savings up to 80% compared to a traditional on-demand virtual machine.

Where to employ it :

  • LAB’s — Suitable for the workload that is the opposite of needing high availability example your lab, test infrastructure
  • Batch Processing If your apps are fault-tolerant and can withstand possible instance preemptions, then preemptible instances can reduce your Compute Engine costs significantly. Batch processing jobs can run on preemptible instances. If some of those instances terminate during processing, the job slows but does not completely stop.
  • Preemptible instances complete your batch processing tasks without placing additional workload on your existing instances and without requiring you to pay full price for additional normal instances.

Where not to employ it:

Remember, preemptible instances are different from conventional VM instances of GCP. Preemptible VMs have the below limitations

  • May terminate at any time. If they terminate within 10 minutes of starting, Google will not charge you.
  • Will be terminated within 24 hours and the instances not covered by any service level agreement (SLA).
  • May not always be available. Availability may vary across zones and regions.
  • Once created, you cannot convert it to the regular instance and you cannot be set to automatically restart.

How to create a preemptable instances

Using GUI

Creating a preemptible instance is the same procedure as creating a normal instance, but you enable the preemptible property.

In the Cloud Console, go to the VM Instances page, Go to the VM Instances page and Click Create instance and fill in the properties.

Lets, now pay attention to the cost until this point I have not enabled the preemptible property and hence the monthly estimation is $27.

Enable preemptibility Under Availability policy, set the Preemptibility option to On.

NOTE: This setting disables automatic restart for the instance and sets the host maintenance action to Terminate.

The cost of the instance has gone down to $8.5 % with the preemptible instance.

Using CLI

Creating preemptible instance using CLI is pretty easy with just a simple command

gcloud compute instances create my-preemptible --preemptible

Result

kp@cloudshell:$ gcloud compute instances create my-preemptible — preemptibleDid you mean zone [asia-southeast1-a] for instance: [my-preemptible](Y/n)? YCreated [https://www.googleapis.com/compute/v1/projects/support-playground/zones/asia-southeast1-a/instances/my-preemptible].NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUSmy-preemptible asia-southeast1-a n1-standard-1 true 10.10.10.8 31.240.119.40 RUNNING

Conclusion

The public cloud is great potential as long as attention is paid to cloud cost optimization.see you next time .!

--

--

Kesavan.P
Kesavan.P

Written by Kesavan.P

Been into IT for the last 9 Years and mostly helping enterprises on Data Protection & Data Management. Certified on AWS/GCP and a product enthusiast .

No responses yet