Use Object Versioning. The Object Versioning feature keeps an archived version of an object whenever you overwrite or delete the live version.
If you accidentally delete an object, you can copy an archived version of it back to the live version. It's recommended that you use Object Versioning in conjunction with Object Lifecycle Management. Doing so ensures that you don't have multiple, unnecessary copies of an object, which are each subject to storage costs.
As an alternative, use object holds. When you place an object hold on an object, it cannot be deleted or overwritten.
Hope it works!!
To find out more about Google Cloud, join Google Cloud training today.
Thanks!