Skip to main content

Delete

Use this page when you need to remove an empty bucket or permanently delete a bucket and its contents.

caution

Permanent action

Deleting a bucket can affect applications, backups, uploads, and any workflow that still depends on that path.

Before you start​

Before deleting a bucket, confirm:

  • no application is still writing to it
  • no backup or export job still depends on it
  • you have copied any data you still need

Example variables​

export S3_ENDPOINT="https://<your-endpoint>"
export S3_REGION="<your-region>"
export AWS_PROFILE="<your-aws-cli-profile>"
export RCLONE_REMOTE="<your-rclone-remote>"
export BUCKET_NAME="<your-bucket-name>"

Delete an empty bucket with AWS CLI​

aws s3 rb s3://$BUCKET_NAME \
--endpoint-url "$S3_ENDPOINT" \
--region "$S3_REGION" \
--profile "$AWS_PROFILE"

Remove objects first, then delete the bucket with AWS CLI​

If the bucket is not empty, remove the current objects first.

aws s3 rm s3://$BUCKET_NAME \
--recursive \
--endpoint-url "$S3_ENDPOINT" \
--region "$S3_REGION" \
--profile "$AWS_PROFILE"

Then remove the bucket.

aws s3 rb s3://$BUCKET_NAME \
--endpoint-url "$S3_ENDPOINT" \
--region "$S3_REGION" \
--profile "$AWS_PROFILE"
note

Versioning

If bucket versioning is enabled, removing the visible objects may not be enough to delete the bucket. If the bucket still does not delete, review the versioning status first and contact support if needed.

Delete an empty bucket with rclone​

rclone rmdir ${RCLONE_REMOTE}:$BUCKET_NAME

Delete a bucket and all its contents with rclone​

Start with a dry run.

rclone purge ${RCLONE_REMOTE}:$BUCKET_NAME --dry-run

If the dry run looks correct, run the command without --dry-run.

rclone purge ${RCLONE_REMOTE}:$BUCKET_NAME

Which command to choose​

  • use aws s3 rb or rclone rmdir when the bucket is already empty
  • use aws s3 rm --recursive before aws s3 rb when you need to remove current objects first
  • use rclone purge only when you want to remove the bucket and everything inside it

When to contact support​

Open a ticket if:

  • the bucket looks empty but still cannot be deleted
  • versioning prevents deletion and you are not sure how to proceed
  • you need help confirming the impact before removal