From the course: Google Cloud Professional Data Engineer Cert Prep: 2 Building and Operationalizing Data Processing Systems

Demo: Compute volatility on GCP

- [Instructor] Here we have the Google Cloud Spot VMs interface that allows us to launch things that are suitable for batch jobs and fault-tolerant workloads. And the advantage of a Spot Virtual Machine is its low cost, and you can save up to 91%. So if you are able to launch this inside of a Kubernetes cluster or attach, for example, some deep learning jobs to this, you can save a lot of money. And the features, if you look at this, are pretty straightforward. And in fact, the command is also pretty straightforward. You just type in gcloud beta compute instances create my-vm and add in the provisioning-model=SPOT. And the features here are pretty straightforward. Again, easy extendability, graceful shutdown, control costs. So kind of a no-brainer for doing prototyping, batch jobs, is to use Spot instances. Let's get right into it. We go over to Compute Engine, we look at VM instances. Instead of going through here and creating the instance from the interface, let's go ahead and do it from the terminal. So in order to do that, what I'm going to do is I'm going to type in gcloud beta, and then compute, and then instances. And then we'll say create. Now, I would put in the name of the virtual machine. We'll just call this my-vm. And also the mode. So we'll say provisioning-model=SPOT. Now, it's going to ask what zone. And by default, it'll pick the zone you're currently in. That's fine. And it's pretty straightforward, actually, to launch this Spot instance and get started. Very, very straightforward. How do we know it exists? We can go to Refresh. There we go. Now, if I want to connect to this thing, I could also go in and open up an SSH connection in another window and bring that over. And that would also allow me to connect to it immediately. So very, very easy process to launch a Spot instance, get started. And as well, I'm only charged by the second. So I could go in and in fact do some things real quickly, upload some files, do whatever it is I need to do, run htop or top command, and kind of get right into doing the work that I need to do. Then, when I'm done, to delete it, I also can do this from the command line. I can type in gcloud beta compute instances delete, and then type in the name of the virtual machine. In this case, it's going to say, "Did you mean this one?" Yes, I did. And we're going to go ahead and say continue, and this will terminate the instance. So a very straightforward process and recommended process for people that are doing prototyping, batch computing, deep learning, to save somewhere from 16 to 91%. You can see it's very straightforward, not a lot of gotchas to use this. And you can easily save significant money by using Spot instances on the Google Cloud Platform.

Contents