Skip to content

Instantly share code, notes, and snippets.

@jsj14
Last active February 4, 2022 03:48
Show Gist options
  • Save jsj14/248c4bf770b211f906af71d1ef5d152f to your computer and use it in GitHub Desktop.
Save jsj14/248c4bf770b211f906af71d1ef5d152f to your computer and use it in GitHub Desktop.
from google.cloud import storage
storage_client = storage.Client(project='your-project-id') #add your ProjectID here
def delete_bucket(bucket_name):
"""Deletes a bucket. The bucket must be empty."""
# bucket_name = "your-bucket-name"
storage_client = storage.Client()
bucket = storage_client.get_bucket(bucket_name)
bucket.delete()
print("Bucket {} deleted".format(bucket.name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment