Skip to content
Pass Microsoft, Cisco, Sap and Salesforce Exams
Menu
  • Home
  • Exams
  • Certifications
  • Cloud Computing
  • Cyber Security
  • Contact Us
  • Log in
  • Sign up
Menu

Command line – Google Associate Cloud Engineer Study Guide

Posted on 2024-09-032024-09-03 by examcert

To create a VM and add the public SSH key to the instance metadata during the creation process, use the following command:
gcloud compute instances create VM_NAME –metadata=ssh-keys=PUBLIC_KEY

Once the VM has been created, we can update its metadata with the public SSH key using the following set of instructions:

  1. First, we need to get the VM metadata. To do so, we need to use the following command:
    gcloud compute instances describe VM_NAME
  2. Create an empty file, and add a username and key using the following format:
    USERNAME: KEY_VALUE
  3. Save the file.
  4. Use the following command line to update the instance metadata:
    gcloud compute instances add-metadata VM_NAME –metadata-from-file ssh-keys=KEY_FILE
    The VM metadata will then be updated:

Figure 4.20 – The SSH key added to the running VM configuration using the command line

Once the changes are done, we can log in to the VM using SSH keys.

The next section focuses on deleting instances by using both the Cloud console and the gcloud command.

Deleting a VM

Deleting a VM is a very straightforward process. Let’s try first to delete the VM in the Cloud console. In order to do that, you don’t have to stop the VM in advance; the deletion can be done while it is running.

Console

Select the VM from the list and then click on the three dots:

Figure 4.21 – The three dots menu with the option to delete the VM

Choose Delete as an action, and then confirm the deletion process:

Figure 4.22 – Confirmation of the VM deletion

Once confirmed, the VM deletion process executes. Remember that this action can’t be stopped.

Command line

The deletion process using the command line is straightforward. Use the following command to initiate the deletion process in the command-line interface:
gcloud compute instances delete VM_name

With each gcloud command, it might be necessary to add the zone where the VM runs. You can append the zone to each gcloud command. Otherwise, you might be asked to specify a zone.

To specify a zone, use –zone=us-central1-a in your gcloud command.

You will be asked whether you wish to proceed, and then the process will start:

Figure 4.23 – VM deletion using the command-line interface

You can confirm that the instance has been deleted by executing the following command:
gcloud compute instances list

Once the command executes, you shouldn’t see the instance you wanted to delete.

Adding a GPU to a VM

Graphical Processing Units (GPUs) can be added to the instances of a VM. GPUs can help render graphics-intensive workloads such as 3D visualization, 3D rendering, virtual applications, and ML computations. It is possible to add them to VMs to support those workloads.

Google Cloud offers many GPU platforms. The details can be found on this website: https://cloud.google.com/compute/docs/gpus.

To locate GPU models available in a specific region or zone, use the following link: https://cloud.google.com/compute/docs/gpus/gpu-regions-zones.

Post navigation

← Starting and stopping a VM – Google Associate Cloud Engineer Study Guide
Console – Google Associate Cloud Engineer Study Guide →

Leave a Reply Cancel reply

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

Categories

  • 100-150 Study Course
  • AWS Study Course
  • AZ-104 Study Course
  • Certified Advanced Salesforce Admin
  • Cisco Study Course
  • CLF-C02 Study Course
  • Google
  • Google Associate Cloud Engineer
  • Microsoft Study Course
  • Salesforce
  • Study Course
© 2024 Zeusexam, Inc. All rights reserved. | Privacy Statement | Terms of Use | Use of Cookies | Trust | Accessibility | Cookie Preferences | Your Privacy Choices