Google Cloud Storage - Object Versioning

Опубликовано: 14 Апрель 2026
на канале: Decode ITES
638
11

#DecodeITeS

Google Cloud Storage - Object Versioning

Google Cloud storage supports object versioning to retrieve the object event after deletion. Object Versioning project your data from overwritten or accidental deletion. It provided you with data security on increasing the cost of storage.
 
When Object versioning is enabled, cloud storage saves the noncurrent version of the object with the generation number. Each time you overwrite the existing object or delete the live version, it stores automatically non-current version and assign uniquely identifiable generation numbers to them.
 
Versioned objects or non-current versions of objects are only visible when explicitly mention (-a) flag to list them.

Non-current versions can be accessed only using command line GSUTIL, accessing non-current object option from the console is not visible
 
Object versioning contains saves 2 generation numbers. One is object generation and the second is meta generation number. That means any change in the metadata of object will also be considered as change and the non current version will be generated.


Usage Syntax
Enable versioning on Bucket gsutil versioning set on gs://[BUCKET_NAME]
Disable versioning on Bucket gsutil versioning set off gs://[BUCKET_NAME]
Get current status of versioning gsutil versioning get gs://[BUCKET_NAME]
View versioned objects with generation number gsutil ls -a gs://[BUCKET_NAME]
Retrieve deleted objects / Copy versioned Object gsutil cp gs://[SOURCE_BUCKET_NAME]/[SOURCE_OBJECT_NAME]#[GENERATION_NUMBER] gs://[DESTINATION_BUCKET_NAME]/[DESTINATION_OBJECT_NAME]
Delete versioned Object gsutil rm gs://[BUCKET_NAME]/[OBJECT_NAME]#[GENERATION_NUMBER]