Delete bucket
Updated at:2025-11-03
Delete a bucket using the following code or with reference to Complete Example.
Java
1public void deleteBucket (BosClient client, String bucketName) {
2 // Delete bucket
3 client.deleteBucket(<BucketName>); //Specify bucket name
4}
Note:
- Before deletion, ensure that all objects and any unfinished multipart uploads in the bucket have been fully removed. Otherwise, the deletion will fail.
- Before deleting a bucket, verify that Cross-Region Replication (CRR) is not enabled for the bucket, and that it is neither the source nor target bucket in any CRR rules. Otherwise, the deletion will fail.
