Fast way of deleting non-empty Google bucket?
Another option is to enable Lifecycle Management on the bucket. You could specify an Age
of 0 days and then wait a couple days. All of your objects should be deleted.
Buckets are required to be empty before they're deleted. So before you can delete a bucket, you have to delete all of the objects it contains.
You can do this with gsutil rm -r
(documentation). Just don't pass the *
wildcard and it will delete the bucket itself after it has deleted all of the objects.
gsutil -m rm -r gs://my-bucket
Google Cloud Storage bucket deletes can't succeed until the bucket listing returns 0 objects. If objects remain, you can get a Bucket Not Empty error (or in the UI's case 'Bucket Not Ready') when trying to delete the bucket.
gsutil
has built-in retry logic to delete both buckets and objects.