我曾經嘗試都s3cmd
:如何使用CLI在AWS S3中刪除版本化存儲桶?
$ s3cmd -r -f -v del s3://my-versioned-bucket/
而且AWS CLI:
$ aws s3 rm s3://my-versioned-bucket/ --recursive
但是這兩個命令只需添加DELETE
標記到S3。刪除存儲桶的命令也不起作用(來自AWS CLI):
$ aws s3 rb s3://my-versioned-bucket/ --force
Cleaning up. Please wait...
Completed 1 part(s) with ... file(s) remaining
remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
好的......怎麼樣? their documentation沒有這方面的信息。 S3Cmd表示這是一個「全功能」的S3命令行工具,但它使得no reference to versions不是它自己的。有沒有辦法做到這一點,而不使用Web界面,這將永遠需要,並要求我保持我的筆記本電腦?
據我所知,您需要遍歷對象版本並將它們批量刪除1000 ... –
如果有某處有示例Java代碼,那就太好了。 AWS文檔真的很糟糕...... – NobleUplift