Google Storage bucket name is not available. Please try a different one
Today in this article, we will cover below aspects,
Issue Description
Google storage bucket create method produces error,
Such error could exist for any language like C# or Python or any other language.
409 POST https://storage.googleapis.com/storage/v1/b?project=test1-303520&prettyPrint=false: You already own this bucket. Please select another name.
OR
409 POST https://storage.googleapis.com/storage/v1/b?project=test1-303520&prettyPrint=false: Sorry, that name is not available. Please try a different one.
Resolution
As per google storage bucket guidelines, every bucket name must be unique across the entire Google Cloud Storage namespace.
This error means the bucket name already exists and you may try with another new name.
After trying with new name, i was able to create Bucket successfully.
For more details , please refer below article,
Sample code
def create_bucket(bucket_name):
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
bucket.storage_class = "NEARLINE"
new_bucket = storage_client.create_bucket(bucket, location="us")
print(
"Created bucket {} in {} with storage class {}".format(
new_bucket.name, new_bucket.location, new_bucket.storage_class
)
)
return new_bucket
Did I miss anything else in these resolution steps?
Did the above steps resolve your issue? Please sound off your comments below!
Happy Coding !!
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.