Delete bucket
Updated at:2025-11-03
Overview
Since users are limited to creating a maximum of 100 buckets, deleting unused buckets can help free up the quota.
Note
- Deleting a bucket might impact associated users and services, so please handle the deletion carefully.
- A bucket can only be deleted when it is null, that is, it does not contain any objects and unfinished three-step upload parts; otherwise, a corresponding prompt will appear. If you need to directly delete a non-empty bucket, you can use the forced deletion command of the CLI Tool:
bce bos rb bos:/<bucket-name> --force.
Operation types
You can delete a bucket through the console, SDK, and API, as follows:
- To delete a bucket through the console, please refer to [Delete Bucket](BOS/Console Operation Guide/Managing Bucket/Delete bucket.md).
-
Deleting a bucket via API:
- [Delete a bucket using the DeleteBucket API](BOS/API Reference/Bucket-Related Interface/Basic Operations/DeleteBucket.md)
-
Deleting a bucket using SDK:
- [Java SDK](BOS/SDK/Java-SDK/Bucket management/Delete bucket.md)
- [Python SDK](BOS/SDK/Python-SDK/Bucket management/Delete bucket.md)
- [PHP SDK](BOS/SDK/PHP-SDK/Bucket management.md#Delete bucket)
- [C# SDK](BOS/SDK/C-Dotnet-SDK/Bucket management.md#Delete bucket)
- [Android SDK](BOS/SDK/Android-SDK/Bucket management/Delete bucket.md)
- [iOS SDK](BOS/SDK/IOS-SDK/Bucket management/Delete bucket.md)
- [JavaScript SDK](BOS/SDK/JavaScript-SDK/Bucket management.md#Delete bucket)
- [GO SDK](BOS/SDK/GO-SDK/Bucket management.md#Delete bucket)
- [Ruby SDK](BOS/SDK/Ruby-SDK/Bucket management/Delete bucket.md)
Example
The following is a code example using Java SDK:
Java
1public void deleteBucket (BosClient client, String bucketName) {
2 // Delete bucket
3 client.deleteBucket(bucketName);
4}
