---
title: "ezgh compute instances attach-volume"
description: "Attach a volume to an instance."
---

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

# ezgh compute instances attach-volume

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh compute instances attach-volume <instance> <volume> [--delete-on-termination] [--wait] [flags]
```

Attach a volume of the project (by ID, UUID or name) to an instance, in its next free slot. On a stopped instance it's done at once and the guest sees it at the next start. On a running instance it's asynchronous: ezgh prints the AttachVolume operation, or with `--wait` waits for it (the guest sees the disk once it succeeds) and prints the instance. A running instance launched before live attach was available has to be stopped and started once first. `--delete-on-termination` deletes the volume when the instance terminates.

Part of [`ezgh compute instances`](/cli/reference/compute-instances).

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--delete-on-termination` | boolean |  | delete the volume when the instance terminates |
| `--wait` | boolean |  | on a running instance, wait until it's attached, and print the instance then |
| `--wait-timeout` | duration | `10m0s` | how long `--wait` waits |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/compute-instances-attach-volume/index.mdx
