> For the complete documentation index, see [llms.txt](https://google-cloud-how-to.smarthive.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://google-cloud-how-to.smarthive.io/buckets/untitled-1.md).

# Creating storage buckets  |  Cloud Storage  |  Google Cloud

This page shows you how to create Cloud Storage buckets. For an overview of buckets, read the [Key Terms](https://cloud.google.com/storage/docs/key-terms#buckets). If not otherwise specified in your request, buckets are created in the [`US` multi-region](https://cloud.google.com/storage/docs/locations) and have a default storage class of [Standard Storage](https://cloud.google.com/storage/docs/storage-classes#standard).

## Console <a href="#storage-create-bucket-console" id="storage-create-bucket-console"></a>

1. Open the Cloud Storage browser in the Google Cloud Console.\
   &#x20;[Open the Cloud Storage browser](https://console.cloud.google.com/storage/browser)
2. Click **Create bucket** to open the bucket creation form.
3. Enter your bucket information and click **Continue** to complete each step:
   * Specify a **Name**, subject to the [bucket name requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements).
   * Select a **Default storage class** for the bucket. The default [storage class](https://cloud.google.com/storage/docs/storage-classes) will be assigned by default to all objects uploaded to the bucket. Next, select a **Location** where the bucket data will be permanently stored.

     **Note:** The **Monthly cost estimate** panel in the right pane estimates the bucket's monthly costs based on your selected storage class and location, as well as your expected data size and operations.
   * Select an **Access control** model to determine how you [control access](https://cloud.google.com/storage/docs/access-control) to the bucket's objects.
   * Optionally, you can add [bucket labels](https://cloud.google.com/storage/docs/key-terms#bucket-labels), set a [retention policy](https://cloud.google.com/storage/docs/bucket-lock), and choose an [encryption method](https://cloud.google.com/storage/docs/encryption).
4. Click **Done**.

## gsutil <a href="#storage-create-bucket-gsutil" id="storage-create-bucket-gsutil"></a>

Use the [`gsutil mb`](https://cloud.google.com/storage/docs/gsutil/commands/mb) command:

```
gsutil mb gs://[BUCKET_NAME]/
```

Where:

* `[BUCKET_NAME]` is the name you want to give your bucket, subject to [naming requirements](https://cloud.google.com/storage/docs/naming#requirements). For example, `my-bucket`.

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. For example, `my-project`.
* `-c`: Specify the default [storage class](https://cloud.google.com/storage/docs/storage-classes) of your bucket. For example, `NEARLINE`.
* `-l`: Specify the [location](https://cloud.google.com/storage/docs/locations) of your bucket. For example, `US-EAST1`.
* `-b`: Enable [uniform bucket-level access](https://cloud.google.com/storage/docs/uniform-bucket-level-access) for your bucket.

For example:

```
  gsutil mb -p [PROJECT_ID] -c [STORAGE_CLASS] -l [BUCKET_LOCATION] -b on gs://[BUCKET_NAME]/
```

## Code samples <a href="#storage-create-bucket-code_samples" id="storage-create-bucket-code_samples"></a>

## REST APIS <a href="#storage-create-bucket-console" id="storage-create-bucket-console"></a>

## JSON API <a href="#storage-create-bucket-json" id="storage-create-bucket-json"></a>

1. Get an authorization access token from the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/). Configure the playground to use your own OAuth credentials.
2. Create a .json file that contains the following information:

   ```
   {
     "name": "[BUCKET_NAME]",
     "location": "[BUCKET_LOCATION]",
     "storageClass": "[STORAGE_CLASS]"
   }
   ```

   Where:

   * `[BUCKET_NAME]` is the name you want to give your bucket, subject to [naming requirements](https://cloud.google.com/storage/docs/naming#requirements). For example, `my-bucket`.
   * `[BUCKET_LOCATION]` is the [location](https://cloud.google.com/storage/docs/locations) where you want to store your bucket's [object data](https://cloud.google.com/storage/docs/key-terms#objects). For example, `US-EAST1`.
   * `[STORAGE_CLASS]` is the default [storage class](https://cloud.google.com/storage/docs/storage-classes) of your bucket. For example, `NEARLINE`.
3. Use [`cURL`](http://curl.haxx.se/) to call the [JSON API](https://cloud.google.com/storage/docs/json_api):

   ```
   curl -X POST --data-binary @[JSON_FILE_NAME].json \
        -H "Authorization: Bearer [OAUTH2_TOKEN]" \
        -H "Content-Type: application/json" \
        "https://storage.googleapis.com/storage/v1/b?project=[PROJECT_ID]"
   ```

   Where:

   * `[JSON_FILE_NAME]` is name of the JSON file you created in Step 2.
   * `[OAUTH2_TOKEN]` is the access token you generated in Step 1.
   * `[PROJECT_ID]` is the ID of the project with which your bucket will be associated. For example, `my-project`.

## XML API <a href="#storage-create-bucket-xml" id="storage-create-bucket-xml"></a>

1. Get an authorization access token from the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/). Configure the playground to use your own OAuth credentials.
2. Create a .xml file that contains the following information:

   ```
   <CreateBucketConfiguration>
      <LocationConstraint>[BUCKET_LOCATION]</LocationConstraint>
      <StorageClass>[STORAGE_CLASS]</StorageClass>
   </CreateBucketConfiguration>
   ```

   Where:

   * `[BUCKET_LOCATION]` is the [location](https://cloud.google.com/storage/docs/locations) where you want to store your bucket's [object data](https://cloud.google.com/storage/docs/key-terms#objects). For example, `US-EAST1`.
   * `[STORAGE_CLASS]` is the default [storage class](https://cloud.google.com/storage/docs/storage-classes) of your bucket. For example, `NEARLINE`.
3. Use [`cURL`](http://curl.haxx.se/) to call the [XML API](https://cloud.google.com/storage/docs/xml-api/overview):

   ```
   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]"
   ```

   Where:

   * `[XML_FILE_NAME]` is name of the XML file you created in Step 2.
   * `[OAUTH2_TOKEN]` is the access token you generated in Step 1.
   * `[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](https://cloud.google.com/storage/docs/naming#requirements). For example, `my-bucket`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://google-cloud-how-to.smarthive.io/buckets/untitled-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
