This lab walks you through Object Versioning for Cloud Storage Bucket.
You will be protecting your data by enabling Object versioning to prevent data loss.
Duration: 30 minutes
Object versioning prevents accidental deletion and also provides the history of what happens with the specific object in the bucket.
Object versioning is best for data recovery processes and it can be enabled at Bucket level and it can be turned on/off at any time.
Whenever you use object versioning, the latest version of the object which you have uploaded will be the live version.
Therefore, Live versions and non-current versions are stored in the same bucket with the same storage class by default.
According to Google recommended practices, you need to use Object versioning in Cloud Storage for sensitive data.
If you have an object and if somebody mistakenly deleted it, then you will lose the object. So, if you have turned on the object versioning for a bucket even if the object is accidentally deleted you can restore it from the previous version.
By enabling object versioning, if you delete/replace a live object in the bucket then it becomes a non-current object version. So, you can restore the deleted object by using the non-current version number.
Older versions are uniquely identified by object key + generation number. By using this identifier you access the older version to perform any actions.
To list current and non-current object versions in CLI. Enter the below command:
Login into GCP Console.
Creating a bucket in Cloud Storage
Enabling Object versioning at the bucket level
Uploading the objects into your bucket.
Deleting one of the objects in the bucket
Ensuring the availability of the deleted objects in CloudShell as well as Cloud Console