Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

🎆 New Year Sale Extension - 25% OFF on ALL Reviewers to Start Your 2026 Strong with our New Year, New Skills Sale!

Back to Course

GCP PlayCloud Labs

0% Complete
0/0 Steps
  1. GCP PlayCloud Labs
  2. Guided Lab: How to Launch a GCP Compute Engine Linux Instance
  3. Guided Lab: Creating a VM Using Instance Templates
  4. Guided Lab: Creating and Managing Instance Groups in Compute Engine
  5. Guided Lab: Creating a Spot VM Instance
  6. Guided Lab: Configuring Shielded VM Options
  7. Guided Lab: Exploring Instance Metadata in Google Cloud
  8. Guided Lab: Vertically Scaling a VM Instance
  9. Guided Lab: Setting up a Web Server on a VM Instance
  10. Guided Lab: Creating a Custom Image from a VM Instance with Web Server in Google Cloud
  11. Guided Lab: Setting Up and Managing a Database on a VM Instance
  12. Guided Lab: Installing WordPress on an Ubuntu VM Instance with LEMP Stack
  13. Guided Lab: Reserving or Promoting a Static IP Address for a VM Instance
  14. Guided Lab: SSH Access to GCP VM Instance from Local Machine using SSH Key Pair
  15. Guided Lab: Creating a Cloud Storage Bucket
  16. Guided Lab: Hosting a Static Website in Google Cloud Storage Bucket
  17. Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning
  18. Guided Lab: Creating a Cloud SQL Instance
  19. Guided Lab: Running SQL Commands in Cloud SQL Studio
  20. Guided Lab: Creating and Restoring Cloud SQL Backups
  21. Guided Lab: Integrating Cloud SQL Database instance with a VM instance
  22. Guided Lab: Connecting Cloud SQL Database with MySQL Workbench (Local)
  23. Guided Lab: Creating a Cloud NAT Gateway
  24. Guided Lab: Creating a Google Kubernetes Engine (GKE) Cluster
  25. Guided Lab: Connecting to a Kubernetes Engine Cluster
  26. Guided Lab: Deploying a Simple Web Application on GKE
Lesson 17 of 26
In Progress

Guided Lab: Protecting Data on Cloud Storage Bucket Against Accidental Delete and Overwrite Using Object Versioning

Description

Google Cloud Storage provides Object Versioning, a feature that helps protect data against accidental deletion or overwrites. When enabled, deleted objects are retained as noncurrent versions that remain accessible in your bucket until you explicitly remove them. This capability allows you to track object changes over time and recover specific versions whenever needed.

In this guided lab, you will learn how to enable Object Versioning on a Cloud Storage bucket and test its behavior by overwriting and deleting objects. By the end of the lab, you’ll understand how to recover previous versions of files stored in your bucket

Prerequisites

This lab assumes you have basic knowledge of creating a Cloud Storage Bucket.
If you find any gaps in your knowledge, consider taking this lab:

Objectives

In this lab, you will:

  • Create a Cloud Storage bucket.
  • Enable Object Versioning on the bucket.
  • Upload and overwrite a file to generate multiple versions.
  • Delete a file and recover it using Object Versioning.

Lab Steps

Create a Cloud Storage Bucket

1. On the Create a bucket page, enter your desired bucket name (should be unique).

2. Leave other configurations at their default values.

3. Click Create.

Enable Object Versioning

1. Navigate to the created bucket.

2. In the Protection section, enable Object Versioning.

3. Keep the checkbox unchecked and select Confirm.

Note:

  • If you check this box, Google Cloud will automatically add lifecycle rules to control storage costs:
    • Max. number of versions per object: 1 (only the latest version is kept).
      • For overwrite protection, you’d need to increase this to at least 2 versions per object.
      • The version count includes both live and noncurrent versions.
    • Expire noncurrent versions after: 7 days (recommended for Standard storage class).
  • For the purpose of this lab, you should leave the checkbox unticked so you can observe multiple (unlimited) versions of the same object and practice recovering them manually. This ensures you see the full effect of Object Versioning without lifecycle rules automatically deleting older versions.

You can also enable Object Versioning during bucket creation by expanding the Choose how to protect object data settings before clicking Create.

Upload and Overwrite a File

1. Create a simple text file named notes.txt with the content:

Version 1: Initial content

2. Upload notes.txt to the bucket.

3. Modify the file locally to:

Version 2: Updated content

4. Upload the modified file again with the same name (notes.txt).

Note: You may see a message saying “Resolve object conflict.” This indicates that multiple versions of the same object exist. Confirm the overwrite to proceed.

  • Cloud Storage will retain both versions.
Delete and Recover a File

1. In the bucket, delete notes.txt.

2. Click Show versions (or Show Live and noncurrent objects) to display all versions of objects.

3. Click the notes.txt (Noncurrent)

4. Locate the noncurrent version of notes.txt (identified by its generation number).

5. Restore or download the older version to recover the file.

Congratulations! You’ve completed the lab and successfully protected your Cloud Storage bucket against accidental deletes and overwrites using Object Versioning. You now know how to enable versioning, overwrite files safely, and recover deleted objects.

Skip to content