HectorJ
HectorJ

Reputation: 6324

How to make a Google Cloud Storage bucket append-only?

Is there a way to make a Google Cloud Storage bucket "append-only"?

To clarify, I want to make it so that trying to overwrite/modify an existing object returns an error.

Right now the only way I see to do this is client-side, by checking if the object exists before trying to write to it, but that doubles the number of calls I need to make.

Upvotes: 1

Views: 611

Answers (1)

John Hanley
John Hanley

Reputation: 81356

There are several Google Cloud Storage features that you can enable:

  1. Object Versioning
  2. Bucket Lock
  3. Retention Policies

The simplest method is to implement Object Versioning. This prevents objects from being overwritten or deleted. This does require changes to client code to know how to request a specific version of an object if multiple versions have been created due to object overwrites and deletes.

Cloud Storge Object Versioning

For more complicated scenarios implement bucket lock and retention policies. These features allow you to configure a data retention policy for a Cloud Storage bucket that governs how long objects in the bucket must be retained

Retention policies and Bucket Lock

Upvotes: 4

Related Questions