Cloud Storage Bucket Versioning and Object Holds
Cloud Storage bucket versioning and object holds are critical features that enhance data management and security within Google Cloud's storage infrastructure. Versioning allows for the preservation of multiple versions of an object within a bucket over time, enabling users to retrieve and restore previous versions as needed. This feature provides protection against accidental deletion or modification of data, ensuring data integrity and compliance with regulatory requirements.
Object holds, on the other hand, enable users to place a temporary lock on objects within a bucket, preventing them from being modified or deleted for a specified period. Object holds are particularly useful in scenarios where data preservation and immutability are paramount, such as legal holds for litigation or compliance purposes. By applying object holds, organizations can prevent data tampering or deletion, thereby maintaining data authenticity and evidentiary value.
Object Versioning
To enable Object Versioning on a bucket:
$ gsutil versioning set on gs://BUCKET_NAME

To check whether Object Versioning is enabled on a bucket:
$ gsutil versioning get gs://BUCKET_NAME

To list both live and noncurrent versions of an object and view their generation numbers:
$ gsutil ls -a gs://BUCKET_NAME

To disable Object Versioning on a bucket:
$ gsutil versioning set off gs://BUCKET_NAME

Object Holds
To automatically place an event-based hold on each new object added to a bucket:
$ gsutil retention event-default set gs://BUCKET_NAME

To view whether a bucket places event-based holds on new objects by default:
$ gsutil ls -L -b gs://BUCKET_NAME

Disabling a default event-based hold
$ gsutil retention event-default release gs://BUCKET_NAME

To place a hold on an object in your bucket:
$ gsutil retention HOLD_TYPE set gs://BUCKET_NAME/OBJECT_NAME

To release a hold on an object in your bucket:
$ gsutil retention HOLD_TYPE release gs://BUCKET_NAME/OBJECT_NAME

Cloud Storage Bucket Versioning and Object Holds