You can use OBS Console, APIs, SDKs, OBS Browser+, or obsutil to delete unwanted or empty buckets to free up the bucket quantity quota and reduce storage costs.
Important Notes
- To reuse the name of a deleted bucket, you must wait until the bucket name is fully released. Deleting a bucket via API typically takes about 30 minutes, but the process can take longer in special situations. For example, if a bucket is deleted due to account arrears or account cancellation, the bucket must be emptied before deletion, which extends the processing time. Because of this, OBS cannot guarantee how long the deletion and release process will take. If you try to create a new bucket using a name that has not yet been released, the creation will fail. Likewise, even after the name is released, if another user claims it before you do, creating a bucket with the same name will also fail.
- Bucket deletion cannot be undone. If you may need the data later, back up the data in the bucket and consider changing the storage class to lower storage costs.
- Deleting a bucket also interrupts any services that rely on it, such as static website hosting and CDN, so proceed with caution.
- If cross-region replication is enabled, deleting a bucket may also remove data in the destination bucket. Review your configuration before you delete the source bucket.
- A bucket must be emptied before it can be deleted, including all objects and fragments. Deleting a large number of items generates API request costs, and the time required depends on how many objects and fragments need to be deleted.
Constraints
Only the bucket owner and users granted the obs:bucket:DeleteBucket permission can delete a bucket. To grant this permission through IAM or bucket policies, see Creating a Custom Policy or Creating a Custom Bucket Policy.
If you have the obs:bucket:DeleteBucket permission in an IAM policy but still cannot delete a bucket, a Deny statement for obs:bucket:DeleteBucket may be present in an SCP or bucket policy. Allow the obs:bucket:DeleteBucket permission and then delete the bucket.
Ways to Delete a Bucket
You can use OBS Console, APIs, SDKs, OBS Browser+, or obsutil to delete a bucket.
Step 1: Delete Objects and Fragments in the Bucket
A bucket can be deleted only after all objects and fragments in it are permanently deleted.
Deleting Objects from a Bucket with Versioning Disabled
Deleting objects individually
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- Select the file or folder you want to delete and choose More > Delete on the right.
Figure 1 Deleting a file or folder
- Click OK to confirm the deletion.
Figure 2 Deleting an object
Batch deleting objects
To delete a large number of objects or periodically generated objects, select multiple objects and delete them in a batch.
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- Select all files or folders or only the ones you want to delete and click Delete above the object list.
- Click OK to confirm the deletion.
You can also use lifecycle rules to periodically delete objects for higher efficiency. For details, see Lifecycle Rules.
Deleting Objects from a Bucket with Versioning Enabled or Suspended
Deleting objects individually
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- Enable Historical Versions.
- Select the file or folder to delete and click Permanently Delete above the search box.
Figure 3 Permanently deleting an object
- In the dialog box, click OK.
Batch deleting objects
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- Enable Historical Versions.
- Select all files or folders or only the ones you want to delete and click Permanently Delete above the search box.
- In the dialog box, click OK.
Deleting Fragments
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- Click Fragments, select the fragment that you want to delete, and click Delete on the right.
You can also select multiple fragments and click Delete above the fragment list to delete them in a batch.
- Click OK to confirm the deletion.
Figure 4 Deleting fragments
Deleting Objects and Fragments with Lifecycle Rules
You can configure lifecycle rules to periodically delete objects and fragments in a bucket.
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, click the desired bucket. The Objects page is displayed.
- In the navigation pane, choose Data Management > Lifecycle Rules.
- Click Create. The Create Lifecycle Rule dialog box is displayed.
- Configure parameters under Basic Information.

Table 1 Parameters under Basic Information | Parameter | Description |
| Status | Whether to enable the lifecycle rule - If Status is enabled, the lifecycle rule will be applied to affected objects as scheduled. The actions that can be triggered include storage class transitions, object deletion, fragment deletion, and removal of expired delete markers.
- If Status is disabled, the lifecycle rule will not be applied.
|
| Rule Name | The name of the lifecycle rule A rule name: - Can be up to 255 characters long.
- Can contain only uppercase letters, lowercase letters, digits, periods (.), underscores (_), and hyphens (-).
|
| Scope | The scope of objects the lifecycle rule applies to - Objects with specified prefix: The rule applies to the objects with the specified prefix in the bucket.
- All objects: The rule applies to all objects in the bucket.
Multiple lifecycle rules may overlap. In such cases, the overlapping must comply with the defined constraints. Otherwise, conflicting rules can cause the configuration to fail. |
| Prefix | If you choose Objects with specified prefix as the scope, you need to specify an object name prefix. The lifecycle rule applies to the objects with the specified prefix. An object name prefix cannot contain special characters: < > |
| Tag | Optional You can add a tag to make the lifecycle rule apply to the objects with the specified tag. - A tag key:
- Can be up to 128 characters long, including letters, digits, and spaces representable in UTF-8, and the following special characters: _ . : = + - @
- Must be case sensitive. If there are multiple tags, each tag key must be unique.
- Cannot be left blank.
- A tag value:
- Can be up to 255 characters long, including letters, digits, and spaces representable in UTF-8, and the following special characters: _ . : = + - @
- Must be case sensitive.
- Can be left blank.
A lifecycle rule can have a maximum of 10 tags configured. Once a tag is used as a filter, Delete Fragments Upon Expiration and Remove Expired Delete Marker cannot be enabled. For details about how to add tags to objects, see Adding Tags to an Object. |
- Configure Current Version and Historical Version to specify how many days after the last update the object should be deleted.
The Historical Version appears only when versioning is enabled or suspended for the bucket.
Figure 5 Configuring Current Version and Historical Version
Step 2: Delete the Bucket
You can use OBS Console, APIs, SDKs, OBS Browser+, or obsutil to delete a bucket.
Using OBS Console
- In the navigation pane of OBS Console, choose Buckets.
- In the bucket list, select the bucket you want to delete, and then click Delete on the right.
The name of a deleted bucket can be reused for another bucket or parallel file system at least 30 minutes after the deletion.
- Click OK to confirm the deletion.
Figure 6 Deleting a bucket
Using the GUI Tool - OBS Browser+
- Log in to OBS Browser+.
- Select the bucket you want to delete and click Delete.
The name of a deleted bucket can be reused for another bucket or a parallel file system at least 30 minutes after the deletion.
- Click Yes to delete the bucket.
Using the CLI Tool - obsutil
Command Line Structure
Examples
Parameter Description
| Parameter | Optional or Mandatory | Description |
| bucket | Mandatory | The bucket name |
| f | Optional (additional parameter) | Runs in force mode. |
| config | Optional (additional parameter) | The user-defined configuration file for executing the current command. For details about parameters that can be configured, see Configuration Parameters. |
| e | Optional (additional parameter) | The endpoint |
| i | Optional (additional parameter) | The user's AK |
| k | Optional (additional parameter) | The user's SK |
| t | Optional (additional parameter) | The user's security token |