Google Compute Engine is an Infrastructure as a Service component of Google Cloud Platform that allows users to launch and manage virtual machine instances. Though each instance is maintained on its persistent disk, Google provides the snapshot option, which can preserve the instance’s current state for future use.
Snapshots retain the exact state of the virtual machine disk at a specific moment and are used to retrieve, transfer, and make data accessible to other resources in your project. Similar to backups, snapshots store the current state of the disk swiftly, securely, and across several places to ensure the integrity of your data.
By periodically creating snapshots, you can:
- Restore the copy from mishaps, unintentional deletions, or data corruption and
- Streamline backup management of huge volumes and conserve storage space
- Store copies on-site to ensure a speedy recovery.
- Schedule the creation of snapshots
- Reduce the cost of maintenance.
Required Permission
To create a snapshot, you need to have the following permission: compute.snapshots.create
Creating a Snapshot
To create a snapshot in compute engine, follow the given steps:
- In the Google Cloud Platform Console, navigate to the Snapshots panel on the left.
- Click the Create Snapshot option.
- Then, enter the snapshot name and a description(optional).
- Next, specify either the default storage destination.
- Finally, press the Create button to commence the process.
After completion, you will be redirected to the snapshot list page on which the newly created snapshot will be accessible.
Restoring from a snapshot
Similar to creating, snapshot restoration is also simple to execute. Firstly, to restore a snapshot and attach the new disk to an existing instance, you will need to have the following permissions:
- compute.disks.create to create a new disk
- compute.instances.attachDisk on the VM instance
- compute.disks.use on the disk to attach
Then, follow the following steps:
- Go to the Disks section and select the ‘Create Disk’ button to create a new disk.
- Then, enter the disk name and type.
- Next, choose the region (you can select any area and zone, regardless of the storage location of the source snapshot).
- Then select Snapshot under Source type.
- Select the name of the snapshot to restore.
- Mention the size of the new disk (the number must be equal to or more than the size of the source disk used to create the snapshot).
- Finally, click the Create button to commence the process.
Following the restoring process, you can attach the new disk to an existing instance. Here are the steps to follow:
- Navigate to the VM instances page.
- Select the instance to which you wish to restore your disk.
- Click Edit at the top of the instance information page.
- Under Additional disks, click Attach existing disk.
- Choose the new disk’s name made from your snapshot.
- Click Done to attach the disk.
- Click Save to save your changes to the instance.
Delete a snapshot
On the snapshots section, select the snapshots you wish to remove and click the Delete button at the top of the screen to delete them.
When you delete a snapshot, it is labelled as deleted. However, a snapshot is eliminated if no other snapshots rely on it for data; otherwise, the data in the deleted snapshot is transferred to the next one in line, thus enlarging it.
Conclusion
In conclusion, persistent disk snapshots in Google Cloud Platform (GCP) are a useful tool for backing up data, recovering from data loss or corruption, creating new persistent disks, and restoring persistent disks to a previous state. Snapshots are stored in Google Cloud Storage and are accessible from any project within the same organization.
- Snapshots are incremental, which means that only the changes made to a persistent disk since the last snapshot are saved. GCP can automatically create snapshots of your persistent disks at regular intervals if you enable the “Snapshot schedule” feature.
- Snapshots are charged based on the amount of data stored in them and the number of read/write operations performed on them, so you should delete snapshots that are no longer needed to cut down your GCP storage charges.
If your organization processes cloud workloads in massive volumes, then you may be at risk of continually over spending with each billing cycle. Book a demo at Economize today to take control of your cloud expenditure and efficiently optimize your cloud costs.