gsutil make bucket command [gsutil mb] is not working
Asked Answered
L

7

13

I am trying to create a bucket using gsutil mb command:

gsutil mb -c DRA -l US-CENTRAL1 gs://some-bucket-to-my-gs

But I am getting this error message:

Creating gs://some-bucket-to-my-gs/...
BadRequestException: 400 Invalid argument.

I am following the documentation from here

What is the reason for this type of error?

Lougheed answered 16/6, 2014 at 17:17 Comment(8)
I just copied and pasted your command, changed the bucket name, and then ran it and it worked, and created the bucket.Senior
The documentation for the error codes, although not helpful in this case, is here: developers.google.com/storage/docs/…Senior
I tried with different bucket names and also with different options. nothing worked for me so far. But I can use other gsutil commands like rsync. But not sure why this gsutil mb command is not working!Lougheed
When did you last update it, try "gsutil version" to see which version you have, I have 4.1Senior
Do you have billing enabled?Senior
I have 4.3 the latest version of gsutilLougheed
yes, I have billing enabledLougheed
Let us continue this discussion in chat.Senior
S
13

One reason this error can occur (confirmed in chat with the question author) is that you have an invalid default_project_id configured in your .boto file. Ensure that ID matches your project ID in the Google Developers Console

If you can make a bucket successfully using the Google Developers Console, but not using "gsutil mb", this is a good thing to check.

Synergism answered 16/6, 2014 at 18:44 Comment(0)
P
15

I got the same error. I was because I used the wrong location. The location parameter expects a region without specifying witch zone.

Eg.

sutil mb -p ${TF_ADMIN} -l europe-west1-b  gs://${TF_ADMIN}

Should have been

sutil mb -p ${TF_ADMIN} -l europe-west1  gs://${TF_ADMIN}
Periodontal answered 26/5, 2019 at 4:50 Comment(0)
S
13

One reason this error can occur (confirmed in chat with the question author) is that you have an invalid default_project_id configured in your .boto file. Ensure that ID matches your project ID in the Google Developers Console

If you can make a bucket successfully using the Google Developers Console, but not using "gsutil mb", this is a good thing to check.

Synergism answered 16/6, 2014 at 18:44 Comment(0)
V
2

I was receiving the same error for the same command while using gsutil as well as the web console. Interestingly enough, changing my bucket name from "google-gatk-test" to "gatk" allowed the request to go through. The original name does not appear to violate bucket naming conventions.

Playing with the bucket name is worth trying if anyone else is running into this issue.

Vallee answered 19/7, 2015 at 16:25 Comment(1)
For me terminal showed BadRequestException: 400 Use of this bucket name is restricted. My attempted bucket name contained "google" and cloud.google.com/storage/docs/naming explicitly states: Bucket names cannot begin with the "goog" prefix. Bucket names cannot contain "google" or close misspellings, such as "g00gle".Lunate
T
1

I got this error when I had capital letter in the bucket name

$gsutil mb gs://CLIbucket-anu-100000
Creating gs://CLIbucket-anu-100000/...
BadRequestException: 400 Invalid bucket name: 'CLIbucket-anu-100000'

$gsutil mb -l ASIA-SOUTH1 -p single-archive-352211      gs://clibucket-anu-100
Creating gs://clibucket-anu-100/..
$
Tidemark answered 4/6, 2022 at 7:12 Comment(0)
K
0

Got this error and adding the default_project_id to the .boto file didn't work. Took me some time but at the end i deleted the credentials file from the "Global Config" directory and recreated the account.

Using it on windows btw...

Kozak answered 18/6, 2014 at 14:53 Comment(0)
D
0

This can happen if you are logged into the management console (storage browser), possibly a locking/contention issue.

May be an issue if you add and remove buckets in batch scripts.

In particular this was happening to me when creating regionally diverse (non DRA) buckets :

gsutil mb -l EU gs://somebucket

Also watch underscores, the abstraction scheme seems to use them to map folders. All objects in the same project are stored at the same level (possibly as blobs in an abstracted database structure).

You can see this when downloading from the browser interface (at the moment anyway).

An object copied to gs://somebucket/home/crap.txt might be downloaded via a browser (or curl) as home_crap.txt. As a an aside (red herring) somefile.tar.gz can come down as somefile.tar.gz.tar so a little bit of renaming may be required due to the vagaries of the headers returned from the browser interface anyway. Min real support level is still $150/mth.

Dulosis answered 18/11, 2014 at 22:32 Comment(0)
P
0

I had this same issue when I created my bucket using the following commands

MY_BUCKET_NAME_1=quiceicklabs928322j22df
MY_BUCKET_NAME_2=MY_BUCKET_NAME_1
MY_REGION=us-central1

But when I decided to add dollar sign $ to the variable MY_BUCKET_NAME_1 as MY_BUCKET_NAME_2=$MY_BUCKET_NAME_1 the error was cleared and I was able to create the bucket

Procurable answered 3/9, 2020 at 23:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.