---
layout: article
title: Buckets
description: Efficiently deploy your Appwrite buckets using the Command-Line Tool (CLI). 
---

{% info title="Before proceeding" %}
Ensure you [**install**](/docs/tooling/command-line/installation#getting-started) the CLI, [**log in**](/docs/tooling/command-line/installation#login) to your Appwrite account, and [**initialize**](/docs/tooling/command-line/installation#initialization) your Appwrite project.
{% /info %}


The Appwrite CLI allows you to configure and deploy buckets across projects. You can also configure your files using the CLI commands.

# Initialize bucket {% #initialize-bucket %}

Create a new bucket using the following command:

```sh
appwrite init buckets
```

# Pull bucket {% #pull-bucket %}

You can also pull your existing Appwrite buckets from the Appwrite Console using the `pull` command in the folder containing your `appwrite.config.json` file.

```sh
appwrite pull buckets
```

# appwrite.config.json {% #appwritejson %}

After [initializing](/docs/tooling/command-line/installation#initialization) your Appwrite project and pulling your existing buckets, your `appwrite.config.json` file should look similar to the following:

```json
{
    "projectId": "<PROJECT_ID>",
    "endpoint": "https://<REGION>.cloud.appwrite.io/v1",
    "buckets": [
        {
            "$id": "<BUCKET_ID>",
            "$createdAt": "2024-06-21T16:20:25.516+00:00",
            "$updatedAt": "2024-06-21T16:21:16.855+00:00",
            "$permissions": [
                "create(\"any\")",
                "read(\"any\")",
                "update(\"any\")",
                "delete(\"any\")"
            ],
            "fileSecurity": false,
            "name": "test",
            "enabled": true,
            "maximumFileSize": 5368709120,
            "allowedFileExtensions": [],
            "compression": "none",
            "encryption": true,
            "antivirus": true
        }
    ]
}
```

You can also move the `buckets` array into a separate JSON file with the `includes` field.

{% arrow_link href="/docs/tooling/command-line/installation#multi-file-configuration" %}
Learn more about multi-file configuration
{% /arrow_link %}

# Push bucket {% #push-bucket %}

Use the `push` command in the folder containing your `appwrite.config.json` file to push the changes you made.


```sh
appwrite push buckets
```

# Commands {% #commands %}

The storage command allows you to manage your project's buckets and files. Appwrite storage CLI commands generally follow the following syntax:

```sh
appwrite storage [COMMAND] [OPTIONS]
```

{% table %}
* Command
* Description
---
* `list-buckets [options]`     
* Get a list of all the storage buckets. You can use the query params to filter your results.
---
* `create-bucket [options]`    
* Create a new storage bucket.
---
* `get-bucket [options]`        
* Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
---
* `update-bucket [options]`     
* Update a storage bucket by its unique ID.
---
* `delete-bucket [options]`     
* Delete a storage bucket by its unique ID.
---
* `list-files [options]`        
* Get a list of all the user files. You can use the query params to filter your results.
---
* `create-file [options]`
* Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of '5MB'. The 'content-range' header values should always be in bytes. When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in 'x-appwrite-id' header to allow the server to know that the partial upload is for the existing file and not for a new one. If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally, including sending multiple chunk requests in parallel when the runtime supports it.
---
* `get-file [options]`          
* Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
---
* `update-file [options]`       
* Update a file by its unique ID. Only users with write permissions have access to update this resource.
---
* `delete-file [options]`       
* Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
---
* `get-file-download [options]`
* Get a file content by its unique ID. The endpoint response returns with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to the user downloads directory.
---
* `get-file-preview [options]`   
* Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
---
* `get-file-view [options]`
*  Get a file content by its unique ID. This endpoint is similar to the download method but returns with no  'Content-Disposition: attachment' header.
---
{% /table %}
