Chapter 10. Deleting a bucket from your object store


To delete a bucket from your object store from your workbench, use the delete_bucket() method.

Prerequisites

  • You have cloned the odh-doc-examples repository to your workbench.
  • You have opened the s3client_examples.ipynb file in your workbench.
  • You have installed Boto3 and configured an S3 client.
  • You have ensured that the bucket that you want to delete is empty.

Procedure

  1. In the Jupyter notebook, locate the following instructions to delete a bucket:

    #Delete bucket
    s3_client.delete_bucket(Bucket='<bucket_name>')
    Copy to Clipboard
  2. Replace <bucket_name> with the name of the bucket that you want to delete and run the code cell.

    #Delete bucket
    s3_client.delete_bucket(Bucket='aqs971-image-registry')
    Copy to Clipboard

    The output displays an HTTP response status code of 200, which indicates that the request was successful.

Verification

  • Locate the instructions to list buckets, and execute the code cell.

    for bucket in s3_client.list_bucket()[‘Buckets’]:
        print(bucket[‘Name’])
    Copy to Clipboard

    The bucket that you deleted does not appear in the output.

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat