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 perform a disk snapshot, we can run the following command:
gcloud compute snapshots create SNAPSHOT_NAME –source-disk=SOURCE_DISK_NAME –source-disk-zone=DISK_ZONE

Figure 4.50 – A command-line snapshot is created

Snapshot creation takes a moment.

After successfully creating the snapshot, we can proceed to delete snapshots.

Deleting an instance snapshot

Deletion of the snapshot is a straightforward process.

Console

In the Cloud console, navigate to the Snapshots section of Storage. Select the desired snapshot and click DELETE:

Figure 4.51 – Snapshot deletion in the Cloud console

After clicking DELETE SNAPSHOT, the deletion takes place.

Command line

Before we can delete a snapshot, we need to know its name and refer to it in the command-line interface.

To list existing snapshots, we need to execute the following command:
gcloud compute snapshots list

Once we have a list of existing snapshots, we can delete them by executing the following command:
gcloud compute snapshots delete SNAPSHOT_NAME

The following screenshot shows the deletion of the snapshot:

Figure 4.52 – A screenshot of the snapshot deletion

As we see in the previous screenshot, the snapshot has been deleted and is no longer present.

Creating an instance snapshot schedule

As we saw, manual snapshot creation works and can be done in the Cloud console and by using command-line tools. There is another possible method, which is to create a snapshot scheduler. This allows us to configure certain things, similar to when we use snapshots:

  • The schedule location
  • The snapshot location
  • Frequency
  • The deletion rule
  • Application consistency
  • Labels

Having the necessary information about the requirements, we can now proceed to create a snapshot schedule in the Cloud console.

Console

In the Cloud console, we need to add details to all the aforementioned necessary fields, and once the snapshot schedule is created, we need to add the disk that to the schedule:

Figure 4.53 – Attaching a snapshot schedule to the disk

Once the disk is added, the snapshot will be executed as per our configuration.

Command line

Similar to the Cloud console, we need to first create a snapshot schedule:
gcloud compute resource-policies create snapshot-schedule SCHEDULE_NAME –project=PROJECT_NAME –region=REGION_NAME –max-retention-days=XX –on-source-disk-delete=keep-auto-snapshots –daily-schedule –start-time=08:00 –storage-location=REGION_NAME

After creating the snapshot schedule, we need to attach it to the instance disk to utilize the feature. Use the following command to do so:
gcloud compute disks add-resource-policies DISK_NAME  –resourcepolicies=SCHEDULE_NAME –zone=ZONE_NAME

After initiating the command, the disk will be attached to a snapshot schedule.

Post navigation

← Resizing a disk – Google Associate Cloud Engineer Study Guide
Introduction to the Cloud – CLF-C02 Study Course →

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