Hello Cloud Gurus,
If you’re doing the Managed Instance Groups (Lab) together with Mattias as I did, after you create instances based on the previously create instance templates, you will notice that it’s going to delay a little bit for the things to start happening on the instances and so, for you to start seeing Console graphs getting populating when going to Console >> Compute Engine >> VM Instances >> Click the Instance Name (worker-instance-from-template-1) >> Monitoring. I had to SSH to the instance to check what was going on and using the top command, I got the very beginning of the stress program execution. Coming back to the Monitoring, I clicked the Reset Zoom button which helped to make graphs to appear. Just a little hint in here.
I noticed also a little change for the screen, as when you go to Console >> Compute Engine >> Instance groups >> Create instance group, you see a separation for Managed Instances and Unmanaged Instances. the main difference between them is that the Managed Instance Group can be on Multiple zones and unmanaged not.
Also, you will notice that every other instance create by the autoscaler will have a suffix for the instance "Name":
There is an additional I would like to consider as part of this lecture. On the final slide, the "Key Takeaways", Mattias comments:
>> Even via CLI — Can create Instance Template via CLI, too
As I got myself curious, I went to test.
Instance Templates are global and can be used to create VMs everywhere. Unless it were created having zonal dependencies like a persistent disk in us-central1-a, you wouldn’t be able to create a VM template-based in the us-west1-b, as mentioned below.
An instance template is a global resource that is not bound to a zone or a region. However, you will specify some zonal resources in an instance template, which restricts the template to the zone where that resource resides. For example, if you include a read-only persistent disk from us-central1-b in your instance template, you cannot use that template in any other zone because that specific disk exists only in zone us-central1-b (https://cloud.google.com/compute/docs/instance-templates/).
The curiosity here is how to create a VM based on a template and then:
pimballeke@cloudshell:~$ gcloud config set project optimistic-leaf-265401 Updated property [core/project]. pimballeke@cloudshell:~ (optimistic-leaf-265401)$ gcloud compute instance-templates list NAME MACHINE_TYPE PREEMPTIBLE CREATION_TIMESTAMP worker-instance-template f1-micro 2020-01-25T11:10:20.270-08:00 pimballeke@cloudshell:~ (optimistic-leaf-265401)$ gcloud compute instances create mybrandnewvm --source-instance-template worker-instance-template Did you mean zone [us-east1-c] for instance: [mybrandnewvm] (Y/n)? Y Created [https://www.googleapis.com/compute/v1/projects/optimistic-leaf-265401/zones/us-east1-c/instances/mybrandnewvm]. NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS mybrandnewvm us-east1-c f1-micro 10.142.0.3 188.8.131.52 RUNNING pimballeke@cloudshell:~ (optimistic-leaf-265401)$ gcloud compute instances delete mybrandnewvm --zone us-east1-c The following instances will be deleted. Any attached disks configured to be auto-deleted will be deleted unless they are attached to any other instances or the `--keep-disks` flag is given and specifies them for keeping. Deleting a disk is irreversible and any data on the disk will be lost. - [mybrandnewvm] in [us-east1-c] Do you want to continue (Y/n)? Y Deleted [https://www.googleapis.com/compute/v1/projects/optimistic-leaf-265401/zones/us-east1-c/instances/mybrandnewvm].
Of course, we can explore more possibilities here, but this is just the beginning.