Farrukh Najmi
Farrukh Najmi

Reputation: 5316

Google cloud storage: Cannot reuse bucket name after deleting bucket

I deleted an existing bucket on google cloud storage using:

gsutil rm -r gs://www.<mydomain>.com

I then verify then bucket was deleted using:

gcloud storage ls gs://www.<mydomain>.com

And I get expected response:

ERROR: (gcloud.storage.ls) gs://www.<mydomain>.com not found: 404.

I then verify then bucket was deleted using:

gsutil ls

And I get expected empty response.

I then tried to recreate a new bucket with same name using:

gsutil mb -p <projectid> -c STANDARD -l US-EAST1 -b on gs://www.<mydomain>.com

I get the unexpected error below indicating bucket still exists:

www.<mydomain>.com
Creating gs://www.<mydomain>.com/...
ServiceException: 409 A Cloud Storage bucket named 'www.<mydomain>.com' already exists. Try another name. Bucket names must be globally unique across all Google Cloud projects, including those outside of your organization.

How can I reuse the bucket name for the bucket that I deleted?

Upvotes: 1

Views: 519

Answers (1)

Farrukh Najmi
Farrukh Najmi

Reputation: 5316

I found the answer to my question here: https://stackoverflow.com/a/44763841

Basically I had deleted the project the bucket was in before or after (not sure) deleting the bucket. For some reason this causes the bucket to still appear to exist even though it does not. The behavior does not seem quite right to me but I believe waiting for billing period to complete and project to be deleted would delete the phantom bucket. Unfortunately this means I have to wait 2 weeks. I will confirm this in 2 weeks.

Upvotes: 1

Related Questions