> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vessl.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# vessl storage

### Overview

Run `vessl storage --help` to view the list of commands, or `vessl storage [COMMAND] --help` to view individual command instructions.

## Commands

### Create an external storage

```
vessl storage create [OPTIONS] NAME
```

| Argument | Description         |
| -------- | ------------------- |
| `NAME`   | Name of the storage |

| Option              | Description                                                                                                                                                                                                                                                                                                                                      |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `--storage-type`    | (Required) Type of the storage. Options: s3, gcs, nfs, host-path.                                                                                                                                                                                                                                                                                |
| `--path`            | (Required) Path to the storage. The format depends on the storage type: <ul><li>For `gcs`: `[bucket_name]/[path]` (e.g., my-gcs-bucket)</li><li>For `s3`: `[bucket_name]/[path]` (e.g., my-s3-bucket)</li><li>For `nfs`: `[server]:[path]` (e.g., my.nfs.com:/shared/data)</li><li>For `host-path`: `[path]` (e.g., /data/host-folder)</li></ul> |
| `--credential-name` | <p>Credential name registered in vessl credentials.</p><p>This option is only required when storage type is `s3` or `gcs`</p>                                                                                                                                                                                                                    |
| `--cluster-name`    | <p>Cluster name of registered in vessl.</p><p>This option is only required when storage type is `nfs` or `host-path`</p>                                                                                                                                                                                                                         |

<Note>
  VESSL External Storage acts as a bridge to external storage services (e.g., S3, GCS, etc.).
  Make sure to configure the external storage settings before proceeding.

  If you do not want to use external storage, you can use the default VESSL storage, `vessl-storage`.
</Note>

#### Examples

1. Create an S3 storage:

```
vessl storage create --storage-type s3 --path my-s3-bucket --credential-name my-s3-credential my-s3-storage 
```

2. Create a GCS(Google Cloud Storage) storage:

```
vessl storage create --storage-type gcs --path my-gcs-bucket --credential-name my-s3-credential my-gcs-storage
```

3. Create an NFS storage:

```
vessl storage create --storage-type nfs --path my.nfs.com:/shared/data --cluster-name my-cluster my-nfs-storage
```

4. Create a Host-Path storage:

```
vessl storage create --storage-type host-path --path /data/host-folder --cluster-name my-cluster my-host-storage
```

### List all storages

```
vessl storage list
```

### Delete an external storage

```
vessl storage delete NAME
```

| Argument | Description         |
| -------- | ------------------- |
| `NAME`   | Name of the storage |

### Create a volume in storage

```
vessl storage create-volume [OPTIONS] NAME
```

| Argument | Description        |
| -------- | ------------------ |
| `NAME`   | Name of the volume |

| Option           | Description                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `--storage-name` | (Required) Name of the storage.                                                               |
| `--tag`          | Tag(s) of the storage. You can attach multiple tags by specifying this option multiple times. |

### List volumes in storage

```
vessl storage list-volumes [OPTIONS]
```

| Option           | Description                     |
| ---------------- | ------------------------------- |
| `--storage-name` | (Required) Name of the storage. |
| `--keyword`      | Keyword to search for.          |

### Delete volume in storage

```
vessl storage delete-volume [OPTIONS] NAME
```

| Argument | Description        |
| -------- | ------------------ |
| `NAME`   | Name of the volume |

| Option           | Description                     |
| ---------------- | ------------------------------- |
| `--storage-name` | (Required) Name of the storage. |

### Copy a volume file

You can copy a file or directory either from local to a VESSL volume or from a VESSL volume to a local path.

```
vessl storage copy-file SOURCE DEST
```

| Argument | Description                                                                                                                                                                                                     |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SOURCE` | <p>Source path. The source can be either a local file path or a VESSL volume.</p><p>If the source is a VESSL volume, `SOURCE` must follow the format: `volume://{STORAGE_NAME}/{VOLUME_NAME}`.</p>              |
| `DEST`   | <p>Destination path. The destination can be either a local file path or a VESSL volume.</p><p>If the destination is a VESSL volume, `DEST` must follow the format: `volume://{STORAGE_NAME}/{VOLUME_NAME}`.</p> |

<Note>One of the paths (either `SOURCE` or `DEST`) must be a local path, and the other must be a VESSL volume path.</Note>

#### Examples

1. Copy a local file to a VESSL volume:

```
vessl storage copy-file ./local-file.txt volume://my-storage/my-volume
```

2. Copy a directory from a VESSL volume to a local path:

```
vessl storage copy-file volume://my-storage/my-volume ./local-directory
```

### List a volume file

```
vessl storage list-files PATH
```

| Argument | Description                                                                              |
| -------- | ---------------------------------------------------------------------------------------- |
| `PATH`   | VESSL volume path. `PATH` must follow the format: `vessl://{STORAGE_NAME}/{VOLUME_NAME}` |

### Delete a volume file

```
vessl storage delete-file PATH
```

| Argument | Description                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------- |
| `PATH`   | VESSL volume path. `PATH` must follow the format: `vessl://{STORAGE_NAME}/{VOLUME_NAME}/{FILE_PATH}` |

| Option              | Description                            |
| ------------------- | -------------------------------------- |
| `-r`, `--recursive` | Required if target file is a directory |
