This page shows you how to create Cloud Storage buckets. For an overview of
buckets, read the Key Terms. If not otherwise specified in your request,
buckets are created in the us multi-regional location
and have a default storage class of Standard Storage.
To create a new storage bucket:
Console
- Open the Cloud Storage browser in the Google Cloud Platform Console.
Open the Cloud Storage browser - Click Create bucket.
- Specify a Name, subject to the bucket name requirements.
- Select a Default storage class for the bucket. The default
storage class will be assigned by default to all
objects uploaded to the bucket.
Note: Click Compare storage classes to compare storage classes and monthly cost estimates .
- A Location where the bucket data will be stored.
- Click Create.
gsutil
Use the gsutil mb
command, replacing [VALUES_IN_BRACKETS] with the
appropriate values:
gsutil mb gs://[BUCKET_NAME]/
Set the following optional flags to have greater control over the creation of your bucket:
-p: specify the project with which your bucket will be associated.-c: specify the default storage class of your bucket.-l: specify the location of your bucket.
For example:
gsutil mb -p [PROJECT_NAME] -c [STORAGE_CLASS] -l [BUCKET_LOCATION] gs://[BUCKET_NAME]/
Code samples
C++
For more information, see the Cloud Storage C++ API reference documentation .
C#
For more information, see the Cloud Storage C# API reference documentation .
Go
For more information, see the Cloud Storage Go API reference documentation .
Java
For more information, see the Cloud Storage Java API reference documentation .
Node.js
For more information, see the Cloud Storage Node.js API reference documentation .
PHP
For more information, see the Cloud Storage PHP API reference documentation .
Python
For more information, see the Cloud Storage Python API reference documentation .
Ruby
For more information, see the Cloud Storage Ruby API reference documentation .
REST APIS
JSON API
For information on available storage classes to set as the default for your bucket, see Storage Classes.
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
- Create a .json file that contains the following information, replacing
[VALUES_IN_BRACKETS]with the appropriate values: - Use
cURLto call the JSON API, replacing[VALUES_IN_BRACKETS]with the appropriate values:curl -X POST --data-binary @[JSON_FILE_NAME].json \ -H "Authorization: Bearer [OAUTH2_TOKEN]" \ -H "Content-Type: application/json" \ "https://www.googleapis.com/storage/v1/b?project=[PROJECT_ID]"
{
"name": "[BUCKET_NAME]",
"location": "[BUCKET_LOCATION]",
"storageClass": "[STORAGE_CLASS]"
}
XML API
For information on available storage classes to set as the default for your bucket, see Storage Classes.
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
- Create a .xml file that contains the following information, replacing
[VALUES_IN_BRACKETS]with the appropriate values: - Use
cURLto call the XML API, replacing[VALUES_IN_BRACKETS]with the appropriate values:curl -X PUT --data-binary @[XML_FILE_NAME].xml \ -H "Authorization: Bearer [OAUTH2_TOKEN]" \ -H "x-goog-project-id: [PROJECT_ID]" \ "https://storage.googleapis.com/[BUCKET_NAME]"
<CreateBucketConfiguration> <LocationConstraint>[BUCKET_LOCATION]</LocationConstraint> <StorageClass>[STORAGE_CLASS]</StorageClass> </CreateBucketConfiguration>