---
layout: docs
page_title: Volume Specification
description: |-
  Learn about the Nomad volume specification. Create and register Container
  Storage Interface (CSI) and dynamic host volumes using the `volume create`
  and `volume register` commands and the equivalent API endpoints. Define
  capability, mount options, topology requests, secrets, and parameters.
---

# Volume Specification

The Nomad volume specification defines the schema for creating and registering
This page provides reference information for the Nomad volume
specification. Create and register Container Storage Interface (CSI) and dynamic
host volumes using the [`volume create`][] and [`volume register`][] commands
and the equivalent API endpoints. Define capability, mount options, topology
requests, secrets, and parameters.

Some attributes are only be supported by one volume type or the other, or a
specific operation, while others may have a different meaning for each action,
so read the documentation for each attribute carefully.

* [CSI volume specification][csi_spec]
* [Dynamic host volume specification][dhv_spec]

Provide the file as either HCL or JSON to the commands and as JSON to
the API. An example HCL configuration for a `volume create` command with a CSI
volume:

```hcl
id           = "ebs_prod_db1"
namespace    = "default"
name         = "database"
type         = "csi"
plugin_id    = "ebs-prod"
snapshot_id  = "snap-12345" # or clone_id, see below
capacity_max = "200G"
capacity_min = "100G"

capability {
  access_mode     = "single-node-reader-only"
  attachment_mode = "file-system"
}

capability {
  access_mode     = "single-node-writer"
  attachment_mode = "file-system"
}

mount_options {
  fs_type     = "ext4"
  mount_flags = ["noatime"]
}

topology_request {
  required {
    topology { segments { "rack" = "R2" } }
    topology { segments { "rack" = "R1", "zone" = "us-east-1a"} }
  }
  preferred {
    topology { segments { "rack" = "R1", "zone" = "us-east-1a"} }
  }
}

secrets {
  example_secret = "xyzzy"
}

parameters {
  skuname = "Premium_LRS"
}
```

[`volume create`]: /nomad/docs/commands/volume/create
[`volume register`]: /nomad/docs/commands/volume/register
[csi_spec]: /nomad/docs/other-specifications/volume/csi
[dhv_spec]: /nomad/docs/other-specifications/volume/host
