Empty a bucket

Delete every object, every older version and every delete marker of a bucket for good, in the background, and keep the bucket and its settings.

Last updated 18 November 2026View as Markdown

Emptying a bucket is the step before deleting it. Replace example-uploads with your bucket's name.

Warning

What is emptied is gone for good. Versioning cannot bring any of it back.

Prerequisites

  • Permission for s3:ListBucketVersions on the bucket (to count and to follow the job) and s3:DeleteObjectVersion on its objects (to start and to stop it). Without them, Empty bucket is unavailable and says "Needs s3:ListBucketVersions and s3:DeleteObjectVersion in this bucket."
  • In the console, also s3:GetBucket on the bucket to open it (without it the bucket's page says "Access denied").
  • The bucket is not one the platform writes (a database's backups, a Kafka cluster's tiered storage): those are emptied together with their database or cluster.

Empty the bucket

  1. Open Object Storage, then open the bucket.
  2. In the ⋯ menu, choose Empty bucket. The dialog counts what the bucket holds, for example "41 objects (12 MB), 30 older versions and 2 delete markers"; it counts at most 10,000 entries, and above that it says "at least". An empty bucket shows "name is empty already."
  3. Enter the bucket's name to confirm, then choose Delete N entries for good (Delete N+ entries for good when the count stopped at 10,000).

A banner on every tab of the bucket shows how many entries are deleted and how many a second. You can leave the page. To stop, choose Stop in the banner.

Result

The job reports status (queued, running, done, failed or cancelled), total (what the bucket held when it started), deleted, failed, perSecond and, once it finished, remaining. The bucket itself and its settings stay.

  • Each version is still checked against your policies and the bucket policy. What they keep is counted in failed and stays; the banner then says "N entries still listed: your policies keep them, or storage did not let go of them yet." with Empty again.
  • After Stop, what was deleted stays deleted; Empty again deletes the rest.
  • 409 Nothing is emptying this bucket answers a cancel when no job runs.
  • 400 This bucket is managed by the platform; it is emptied with its resource. for a bucket the platform writes.

Delete one folder

To delete everything under one prefix instead of the whole bucket, choose Delete folder in the folder's menu on Objects (see Delete objects and folders), or call delete-prefix:

On the bucket's Objects tab, in the folder's menu, choose Delete folder.

Each call works for about 20 seconds and answers { deleted, failed, errors, done, cursor }. While done is false, call again with the cursor it returned. allVersions: true also deletes every version and delete marker under the prefix for good and needs s3:DeleteObjectVersion; false deletes the current objects, which a versioned bucket keeps as older versions. With prefix "" and allVersions: true it empties the bucket.

With an S3 client

aws s3 rm s3://example-uploads --recursive removes the current objects. Older versions and delete markers need aws s3api delete-objects with their VersionIds, which needs s3:DeleteObjectVersion.

Did this page help you?