How do I delete a versioned bucket in AWS S3 using the CLI?

前端 未结 20 934
我在风中等你
我在风中等你 2020-12-07 16:34

I have tried both s3cmd:

$ s3cmd -r -f -v del s3://my-versioned-bucket/

And the AWS CLI:

$ aws s3 rm s3://my-v         


        
20条回答
  •  时光取名叫无心
    2020-12-07 17:01

    Even though technically it's not AWS CLI, I'd recommend using AWS Tools for Powershell for this task. Then you can use the simple command as below:

    Remove-S3Bucket -BucketName {bucket-name} -DeleteBucketContent -Force -Region {region}
    

    As stated in the documentation, DeleteBucketContent flag does the following:

    "If set, all remaining objects and/or object versions in the bucket are deleted proir (sic) to the bucket itself being deleted"

    Reference: https://docs.aws.amazon.com/powershell/latest/reference/

提交回复
热议问题