Fast way of deleting non-empty Google bucket?

前端 未结 7 1645
一整个雨季
一整个雨季 2021-02-07 02:05

Is this my only option or is there a faster way?

# Delete contents in bucket (takes a long time on large bucket)
gsutil -m rm -r gs://my-bucket/*

# Remove bucke         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-07 02:32

    Shorter one liner for the lifecycle change:

    gsutil lifecycle set <(echo '{"rule":[{"action":{"type":"Delete"},"condition":{"age":0}}]}') gs://MY-BUCKET
    

    I've also had good luck creating an empty bucket then starting a transfer to the bucket I want to empty out. Our largest bucket took about an hour to empty this way; the lifecycle method seems to take at least a day.

提交回复
热议问题