I set my account (khanhxxxx@gmail.com) to storage admin and storage object admin, but i still cannot delete a object inside a bucket which i accidentally set retention policy. Please help me.
Hello @Khanhnam273 ,Welcome on Google Cloud Community.
Please check this guide: https://cloud.google.com/storage/docs/using-bucket-lock#set-policy
PS: If you locked your bucket, you will not able to remove retention policy and decrease the retention period for the bucket.
How to check retention policy and lock status: https://cloud.google.com/storage/docs/using-bucket-lock#view-policy
--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost
Thanks DamianS for your quick reply.
How about Using this command with flag: --clear-retention-period
from this guidance: https://cloud.google.com/storage/docs/using-bucket-lock#command-line.
At which case this command will take effect and remove retension policy ?
It should be a way to remove it right for example some stupid guy like me who set it for 100 years ?
Please help me with my case. I am grateful for that.
Hello,
If you have bucket retention policy and want to clear this policy , you must use command
gsutil retention clear gs://BUCKET_NAME
It will remove this value ( red arrow )
But if you locked your bucket, you will not being able to remove such retention policy
So sad that iam in the retention lock mode. I played with terraform and set it by accident.
If I am (user/serviceaccount) the one who lock it so I should have permission to unlock it right ? please tell me that I will have a way to unlock it. Please please...
Bucket locks are there to prevent accidental and purposeful deletion, you cannot remove the bucket once locked until all objects have met the retention period and the documentation is clear on that. Your only options are:
1) Wait for all objects to expire the retention period, an empty bucket can be deleted. See:
2) You can delete the entire project - but note that activating a retention will also activate a project lien to prevent accidental project deletion - this requires explicit IAM roles in order to remove this. See: https://cloud.google.com/resource-manager/docs/project-liens