Delete bucket
Updated at:2025-11-03
Delete bucket
-
Basic workflow
- Create a BosClient instance.
- Run the deleteBucket() method.
-
Example code
JavaScript1client.deleteBucket(<BucketName>) 2 .then(function() { 3 // Deletion completed 4 }) 5 .catch(function(error) { 6 // Deletion failed 7 });Plain Text1> **Note:** 2> 3> - If the bucket is not empty (i.e., it contains objects or unfinished three-step upload parts), it cannot be deleted. You must empty the bucket first to delete it successfully. 4> - 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.
