Discover
Get started
Create buckets
Access and manage buckets
Upload and download objects
Access and manage objects
Get insights on your stored data
Cache objects
Control data lifecycles
Make requests
Secure data
Monitor data and usage
Protection, backup, and recovery
Mount buckets with Cloud Storage FUSE
Work across products, Clouds, and platforms
Troubleshoot
Stay organized with collections Save and categorize content based on your preferences.
This page shows you how to create a Cloud Storage bucket. If not otherwise specified in your request, buckets are created in the US
multi-region with a default storage class of Standard storage and have a seven-day soft delete retention duration.
In order to get the required permissions for creating a Cloud Storage bucket, ask your administrator to grant you the Storage Admin (roles/storage.admin
) IAM role for the project.
This predefined role contains the permission required to create a bucket. To see the exact permissions that are required, expand the Required permissions section:
Required permissionsstorage.buckets.create
storage.buckets.enableObjectRetention
(only required if enabling object retention configurations for the bucket)storage.buckets.list
(only required if creating a bucket using the Google Cloud console.)resourcemanager.projects.get
(only required if creating a bucket using the Google Cloud console)You might also be able to get these permissions with custom roles or other predefined roles. To see which roles are associated with which permissions, refer to IAM roles for Cloud Storage.
For instructions on granting roles for projects, see Manage access to projects.
Create a new bucketIf you are creating a bucket for the first time, see Discover object storage with the Google Cloud console or Discover object storage with the Google Cloud CLI tool.
To create a bucket with specific settings or advanced configurations, complete the following steps:
Console Note: When creating a bucket using the Google Cloud console, you are only required to set a globally unique name for your bucket; all other steps are either optional or have default settings.Click add_box Create.
On the Create a bucket page, enter your bucket information. After each of the following steps, click Continue to proceed to the next step:
In the Get started section, do the following:
Enter a globally unique name that meets the bucket name requirements.
To add a bucket label, click the expand_more expander arrow to expand the Labels section, click add_box Add label, and specify a key
and a value
for your label.
In the Choose where to store your data section, do the following:
Select a Location type.
Use the location type's drop-down menu to select a Location where object data within your bucket will be permanently stored.
To set up cross-bucket replication, select Add cross-bucket replication via Storage Transfer Service and follow the steps:
Set up cross-bucket replicationIn the Replication settings section, click Configure to configure settings for the replication job.
The Configure cross-bucket replication pane appears.
In the Choose how to store your data section, do the following:
In the Optimize storage for data-intensive workloads section, do the following:
To enable hierarchical namespace, select Enable Hierarchical namespace on this bucket.
Note: You cannot enable hierarchical namespace in an existing bucket.To enable Anywhere Cache, select Enable Anywhere Cache.
Note: Additional permissions are required to enable Anywhere Cache. For more information, see Required permissions.To create caches, click Configure.
In the Configure cache settings dialog that appears, click the drop-down arrow next to the listed regions and select the zones where you want to create caches.
Click Done.
Click Continue.
In the Choose how to control access to objects section, select whether or not your bucket enforces public access prevention, and select an access control model for your bucket's objects.
Note: If public access prevention is already enforced by your project's organization policy, the Prevent public access checkbox is locked.In the Choose how to protect object data section, do the following:
Select any of the options under Data protection that you want to set for your bucket.
To enable soft delete, click expand_more expander arrow labeled soft delete policy, and specify the number of days you want to retain objects after deletion.
To choose how your object data will be encrypted, click the expand_more expander arrow labeled Data encryption, and select a Data encryption method.
Click Create.
To learn how to get detailed error information about failed Cloud Storage operations in the Google Cloud console, see Troubleshooting.
Command line Note: Cloud Shell provisions a temporary virtual machine. If you want to upload objects to Cloud Storage or download objects from Cloud Storage, use a local development environment.In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
In your development environment, run the gcloud storage buckets create
command:
gcloud storage buckets create gs://BUCKET_NAME --location=BUCKET_LOCATION
Where:
BUCKET_NAME
is the name you want to give your bucket, subject to naming requirements. For example, my-bucket
.BUCKET_LOCATION
is the location of your bucket. For example, US
.
--location
flag to be the location code associated with the underlying regions, and you must use the --placement
flag with a valid pair of regions. For example, --location=ASIA --placement=ASIA-EAST1,ASIA-SOUTHEAST1
.If the request is successful, the command returns the following message:
Creating gs://BUCKET_NAME/...
Set the following flags to have greater control over the creation of your bucket:
--project
: Specify the project ID or project number with which your bucket will be associated. For example, my-project
.--default-storage-class
: Specify the default storage class of your bucket. For example, STANDARD
.--uniform-bucket-level-access
: Enable uniform bucket-level access for your bucket.--soft-delete-duration
: Specify a soft delete retention duration, which is the number of days you want to retain objects after they get deleted. For example, 10d
.For example:
gcloud storage buckets create gs://BUCKET_NAME --project=PROJECT_ID --default-storage-class=STORAGE_CLASS --location=BUCKET_LOCATION --uniform-bucket-level-access --soft-delete-duration=RETENTION_DURATION
For a complete list of options for bucket creation use the gcloud CLI, see buckets create
options.
bucket.insert
C++
For more information, see the Cloud Storage C++ API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
C#For more information, see the Cloud Storage C# API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
GoFor more information, see the Cloud Storage Go API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
JavaFor more information, see the Cloud Storage Java API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
Node.jsFor more information, see the Cloud Storage Node.js API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
PHPFor more information, see the Cloud Storage PHP API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
PythonFor more information, see the Cloud Storage Python API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
RubyFor more information, see the Cloud Storage Ruby API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
TerraformYou can use a Terraform resource to create a storage bucket.
REST APIs JSON APIHave gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Create a JSON file that contains the settings for the bucket, which must include a name
for the bucket. See the Buckets:Insert documentation for a complete list of settings. The following are common settings to include:
{ "name": "BUCKET_NAME", "location": "BUCKET_LOCATION", "storageClass": "STORAGE_CLASS", "iamConfiguration": { "uniformBucketLevelAccess": { "enabled": true }, } }
Where:
BUCKET_NAME
is the name you want to give your bucket, subject to naming requirements. For example, my-bucket
.
BUCKET_LOCATION
is the location where you want to store your bucket's object data. For example, US
.
location
parameter to be the location code associated with the underlying regions, and you must also include a customPlacementConfig
parameter.STORAGE_CLASS
is the default storage class of your bucket. For example, STANDARD
.
Use cURL
to call the JSON API:
curl -X POST --data-binary @JSON_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ "https://storage.googleapis.com/storage/v1/b?project=PROJECT_IDENTIFIER"
Where:
JSON_FILE_NAME
is name of the JSON file you created in Step 2.PROJECT_IDENTIFIER
is the ID or number of the project with which your bucket will be associated. For example, my-project
.Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Create an XML file that contains settings for the bucket. See the XML: Create a bucket documentation for a complete list of settings. The following are common settings to include:
<CreateBucketConfiguration> <StorageClass>STORAGE_CLASS</StorageClass> <LocationConstraint>BUCKET_LOCATION</LocationConstraint> </CreateBucketConfiguration>
Where:
STORAGE_CLASS
is the default storage class of your bucket. For example, STANDARD
.
BUCKET_LOCATION
is the location where you want to store your bucket's object data. For example, US
.
<LocationConstraint>
element to be the location code associated with the underlying regions, and you must also include a <CustomPlacementConfig>
element.curl -X PUT --data-binary @XML_FILE_NAME \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "x-goog-project-id: PROJECT_ID" \ "https://storage.googleapis.com/BUCKET_NAME"
Where:
XML_FILE_NAME
is name of the XML file you created in Step 2.PROJECT_ID
is the ID of the project with which your bucket will be associated. For example, my-project
.BUCKET_NAME
is the name you want to give your bucket, subject to naming requirements. For example, my-bucket
.If the request was successful, a response is not returned.
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage freeExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4