K M Rakibul Islam
K M Rakibul Islam

Reputation: 34336

gsutil make bucket command [gsutil mb] is not working

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?

Upvotes: 13

Views: 16206

Answers (7)

Anuradh Kulkarni
Anuradh Kulkarni

Reputation: 11

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/..
$

Upvotes: 1

DotSam
DotSam

Reputation: 1

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

Upvotes: 0

martins
martins

Reputation: 10009

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}

Upvotes: 15

vtrubets
vtrubets

Reputation: 371

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.

Upvotes: 2

mckenzm
mckenzm

Reputation: 1830

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.

Upvotes: 0

doubleorseven
doubleorseven

Reputation: 364

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...

Upvotes: 0

Travis Hobrla
Travis Hobrla

Reputation: 5509

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.

Upvotes: 13

Related Questions