You can delete a bucket that you no longer use.

Note For more information about the API operation called to delete a bucket, see DeleteBucket.

Prerequisites

  • All objects in the bucket are deleted. For more information about how to delete a small number of objects, see Delete objects. To delete a large number of objects, we recommend you configure lifecycle rules to batch delete the objects. For more information about how to delete a large number of objects, see Configure lifecycle rules.

    If versioning is enabled for the bucket you want to delete, make sure that all versions of objects in the bucket are deleted. For more information about how to delete all versions of objects in a bucket, see Configure versioning.

  • Parts generated by multipart upload or resumable upload tasks in the bucket are deleted. For more information about how to delete parts, see Manage parts.
  • All LiveChannels in the bucket are deleted. For more information about how to delete LiveChannel, see DeleteLiveChannel .
Warning You cannot recover deleted buckets. Exercise caution when you delete a bucket.

Implementation methods

Implementation method Description
Console A user-friendly and intuitive web application
ossbrowser An easy-to use graphical tool
ossutil A high-performance command-line tool
Java SDK SDK demos for various programming languages
Python SDK
PHP SDK
Go SDK
C SDK
.NET SDK
Android SDK
iOS SDK
Node.js SDK
Ruby SDK

FAQ

  • What do I do if I am unable to delete a bucket?

    The bucket cannot be deleted because the bucket is not empty, or you are not authorized to delete the bucket. Troubleshoot this issue based on following causes:

    • The bucket is not empty.

      Make sure that all objects, parts and LiveChannels are deleted from the bucket.

    • You are not authorized to delete the bucket.

      The bucket is empty, but you are not authorized to delete the bucket as a Resource Access Management (RAM) user. Obtain permissions based on the following causes:

      • You do not have the oss:DeleteBucket permission: If you cannot delete the bucket as a RAM user, request a RAM user who has the administrator permissions to add the oss:DeleteBucket permission to the RAM policy.
      • The Deny statement is configured for the oss:DeleteBucket permission in the bucket policy: If the oss:DeleteBucket permission is added to the RAM policy but the bucket cannot be deleted, the bucket policy contains the Deny statement for the oss:DeleteBucket permission. You must change Deny to Allow or directly delete the bucket policy. Then, you can delete the bucket.
  • Why am I unable to create a bucket whose name is the same as that of a deleted bucket?

    After you delete a bucket, you are not allowed to create a bucket that has the same name as the deleted bucket within approximately 30 minutes.