A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/storage/docs/creating-buckets below:

Create a bucket | Cloud Storage

Skip to main content Create a bucket

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.

Note: A bucket's name is non-editable metadata. If you need to designate a specific name, it must be specified at bucket creation. Required roles Note: The following content describes the required IAM roles and permissions for creating a bucket with basic settings. If you want to set up cross-bucket replication as part of creating your bucket, you need additional roles and permissions. Refer to Before you begin in the cross-bucket replication user guide for information on the roles and permissions required.

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 permissions

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 bucket

If 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.
  1. In the Google Cloud console, go to the Cloud Storage Buckets page.

    Go to Buckets

  2. Click add_box Create.

  3. On the Create a bucket page, enter your bucket information. After each of the following steps, click Continue to proceed to the next step:

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

    2. In the Choose where to store your data section, do the following:

      1. Select a Location type.

      2. Use the location type's drop-down menu to select a Location where object data within your bucket will be permanently stored.

      3. To set up cross-bucket replication, select Add cross-bucket replication via Storage Transfer Service and follow the steps:

        Set up cross-bucket replication
        1. In the Bucket menu, select a bucket.
        2. In the Replication settings section, click Configure to configure settings for the replication job.

          The Configure cross-bucket replication pane appears.

          • To filter objects to replicate by object name prefix, enter a prefix with which you want to include or exclude objects, then click add Add a prefix.
          • To set a storage class for the replicated objects, select a storage class from the Storage class menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.
          • Click Done.
    3. In the Choose how to store your data section, do the following:

      1. Select a default storage class for the bucket or Autoclass for automatic storage class management of your bucket's data.
    4. In the Optimize storage for data-intensive workloads section, do the following:

      1. To enable hierarchical namespace, select Enable Hierarchical namespace on this bucket.

        Note: You cannot enable hierarchical namespace in an existing bucket.
      2. To enable Anywhere Cache, select Enable Anywhere Cache.

        Note: Additional permissions are required to enable Anywhere Cache. For more information, see Required permissions.
        1. To create caches, click Configure.

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

        3. Click Done.

    5. Click Continue.

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

  4. 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.
  1. In the Google Cloud console, activate Cloud Shell.

    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.

  2. In your development environment, run the gcloud storage buckets create command:

    gcloud storage buckets create gs://BUCKET_NAME --location=BUCKET_LOCATION

    Where:

    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:

    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.

Client libraries Note: Other options for creating a new bucket can be found in the JSON API reference for 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.

Go

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

Java

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

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

PHP

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

Python

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

Ruby

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

Terraform

You can use a Terraform resource to create a storage bucket.

REST APIs JSON API
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

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

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

XML API
  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

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

  3. Use cURL to call the XML API:

    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:

    If the request was successful, a response is not returned.

What's next Try it for yourself

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 free

Except 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