我曾经尝试都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