Skip to content

CLI Volume

github-actions[bot] edited this page Oct 11, 2026 · 9 revisions

CLI: Volume

attach-volume

Kind: Write.

Already attached to --server-id: Changed is false and nothing is sent. Attached to a different server, the PUT reaches the server, which refuses it with its own error. Keeps the transport's normal PUT retries: a repeat is refused as already attached, never a second charge. Without --no-wait, waits up to 5 minutes for the volume to read IN-USE with --server-id among its attached servers; ERROR during that wait is WriteFailed, and the bound running out is NotSettled, a rerun is safe, since this command always reads first.

An encrypted volume attached live to a server created with encrypted disks. Attaching one to any other server is untested, and the server may refuse it.

If this resource is managed by OpenTofu or Terraform, a write made here drifts from that tracked state; keep such a resource's writes in the tool that manages it.

Flag Type Required
--volume-id string yes
--server-id string yes
--no-wait bool
vngcloud volume attach-volume --volume-id <volume-id> --server-id <server-id>

create-volume

Kind: Write.

Orders nothing above --max-price, default 0: a bare create-volume refuses with error code PriceAboveMax until --max-price is raised to at least the quoted price. A quote of 0 is refused as Unpriced whatever --max-price says. Refuses, before any request, a volume already named --name exactly. The order itself is never retried after a failure that may have already reached the server; list volumes by name before ordering again rather than repeating this command. Without --no-wait, waits up to 5 minutes for the new volume to reach AVAILABLE, then prints it; a timeout, or ERROR during that wait, is NotSettled or WriteFailed, and this create must not be repeated. --no-wait returns at once with only the new volume's UUID and Name set.

--encryption-type-id creates an encrypted volume. The ID comes from volume list-encryption-types: aes-xts-plain64_128 or aes-xts-plain64_256. An unknown ID is refused by the server. An encrypted volume costs the same price as a plain one of the same size and type, live. Read the encryption type back with volume get-volume; get-underlying-volume does not carry it.

If this resource is managed by OpenTofu or Terraform, a write made here drifts from that tracked state; keep such a resource's writes in the tool that manages it. Prices are VND totals that include VAT; the API gives no VAT breakdown.

Flag Type Required
--name string yes
--zone-id string yes
--size int yes
--volume-type-id string yes
--encryption-type-id string
--auto-renew bool
--max-price float64
--no-wait bool
vngcloud volume create-volume --name <name> --zone-id <zone-id> --size <size> --volume-type-id <volume-type-id>

delete-volume

Kind: Write, destructive.

Destroys the volume's data; there is no undo. Refuses, before any request, with error code VolumeInUse when a pre-delete read shows the volume attached to a server; detach it first. Without --no-wait, waits up to 5 minutes for the volume to reach 404 or DELETED; a timeout, or ERROR during that wait, is NotSettled or WriteFailed, but a rerun is always safe, since this command reads the volume first every time.

If this resource is managed by OpenTofu or Terraform, a write made here drifts from that tracked state; keep such a resource's writes in the tool that manages it.

Flag Type Required
--volume-id string yes
--no-wait bool
vngcloud volume delete-volume --volume-id <volume-id> --yes

detach-volume

Kind: Write, destructive.

Needs --yes: detaching a volume can lose unwritten data if it is still mounted. Not attached to --server-id: Changed is false and nothing is sent. Otherwise always reads --server-id next, --allow-running included, since the boot-volume guard below needs that read regardless. Refuses, before any request, with error code BootVolume when the volume is --server-id's own boot volume, or when that read cannot confirm --server-id's boot volume at all; a server cannot boot without one. Refuses, before any request, with error code ServerRunning when --server-id is not STOPPED and --allow-running is not set, since the volume may be mounted there and detaching it under a mounted filesystem can lose unwritten data; stop the server first, or unmount it yourself and pass --allow-running to skip only this status check. Keeps the transport's normal PUT retries: a repeat is refused as already available, never a second charge. Without --no-wait, waits up to 5 minutes for the volume to read AVAILABLE; ERROR during that wait is WriteFailed, and the bound running out is NotSettled, a rerun is safe, since this command always reads first.

If this resource is managed by OpenTofu or Terraform, a write made here drifts from that tracked state; keep such a resource's writes in the tool that manages it.

Flag Type Required
--volume-id string yes
--server-id string yes
--allow-running bool
--no-wait bool
vngcloud volume detach-volume --volume-id <volume-id> --server-id <server-id> --yes

get-default-volume-type

Kind: Read.

Without --zone-id, the API looks up the region's first zone, which can be disabled for the account and then reads as NotFound; pass an enabled zone's ID instead, found with portal list-zones.

Flag Type Required
--zone-id string
vngcloud volume get-default-volume-type --query VolumeType

get-underlying-volume

Kind: Read.

Verified live: this output shape was read from a real encrypted volume.

The output does not carry the encryption type; use volume get-volume to read it.

Flag Type Required
--volume-id string yes
vngcloud volume get-underlying-volume --volume-id <volume-id> --query Volume

get-volume

Kind: Read.

Verified live: this output shape was read from a real encrypted volume.

This command reads a volume's encryption type (EncryptionType); null means the volume is not encrypted.

Flag Type Required
--volume-id string yes
vngcloud volume get-volume --volume-id <volume-id> --query Volume

get-volume-type

Kind: Read.

Flag Type Required
--volume-type-id string yes
vngcloud volume get-volume-type --volume-type-id <volume-type-id> --query VolumeType

list-all-snapshots

Kind: Read.

No fields.

vngcloud volume list-all-snapshots

list-encryption-types

Kind: Read.

Lists the encryption types the project offers, live aes-xts-plain64_128 and aes-xts-plain64_256. Pass the ID to volume create-volume --encryption-type-id, or to compute create-server --root-disk-encryption-type-id and --data-disk-encryption-type-id.

No fields.

vngcloud volume list-encryption-types

list-snapshot-backends

Kind: Read.

Works only in hcm-3. Find the snapshot backend ID with vngcloud volume list-snapshot-backends --name HCM-03, then pass the ID to list-snapshot-policies --backend-id <id>. Snapshot backend IDs are not Backup Center IDs. Every list prints {"Items": [...]}, so a --query starts with Items.

Flag Type Required
--name string yes
vngcloud volume list-snapshot-backends --name <name>

list-snapshot-policies

Kind: Read.

Works only in hcm-3. Uses the profile's project and reads one page: page 1 and size 10 by default. Weekly and monthly schedule details are not included; only their enable flags are returned. Every list prints {"Items": [...]}, so a --query starts with Items. Find the backend ID with list-snapshot-backends.

Flag Type Required
--backend-id string yes
--page int
--size int
vngcloud volume list-snapshot-policies --backend-id <backend-id>

list-snapshots

Kind: Read.

Unverified live: the test account has no volume, so this output shape comes from GreenNode's official SDK, not a live capture.

Flag Type Required
--volume-id string yes
--page int
--size int
vngcloud volume list-snapshots --volume-id <volume-id>

list-volume-prices

Kind: Read.

Returns Items and Metadata for account-scoped monthly quotes. Unknown costs remain null in JSON and print unknown in table/text. Price per GB is the effective rate at the quoted size, not a marginal tariff. Table/text notes print on stderr. With --allow-partial, incomplete output prints before the error and exits 1, even with --query. Sort before queries with --sort-by name, monthly-price, or unit-price and --descending. Unknown numeric values sort last in either direction. Default MaxRequests is 500 (range 1..2000). Catalog reads and quotes run serially with a ten-minute child deadline and at least 500 ms between request starts. Quotes reserve no future price or capacity. Size 0 uses each type's minimum. Encryption defaults to all; none omits encryption from the quote, and an exact returned key selects that encryption type. Disabled zones and sizes outside an offering's bounds remain inapplicable rows without quotes. Quotes exclude snapshots, backups, and server CES.

Flag Type Required
--zone-id string
--volume-type-id string
--iops int
--size int
--encryption string
--max-requests int
--allow-partial bool
--descending bool
--sort-by string
vngcloud volume list-volume-prices

list-volume-type-zones

Kind: Read.

Flag Type Required
--zone-id string
vngcloud volume list-volume-type-zones

list-volume-types

Kind: Read.

Without a zone flag, lists the project's volume types. --volume-type-zone-id makes one request. --zone-id (a network zone, from portal list-zones) first lists that zone's volume type zones, then lists the types of each, one at a time: 1+M requests for M volume type zones. Setting both zone flags exits 2 before any request. --iops keeps only types whose IOPS equals it exactly, in every mode; 0 is no filter and a negative value exits 2. Rows follow the volume type zone order, and each row's VolumeTypeZoneID names the volume type zone it came from. A row's ZoneID is the API's own zone identifier, not the network zone name: filter rows by VolumeTypeZoneID or by the zone you asked for. --iops does not name one type: in HCM03-1A, --iops 3000 returns two types that are both named "3000" and priced differently for 10 GB (32,960 and 32,000 VND), so pick a type by ID, not by Name.

The command that finds each ID create-server takes is on IDs for Create Server.

Flag Type Required
--volume-type-zone-id string
--zone-id string
--iops int
vngcloud volume list-volume-types --zone-id <zone-id>

list-volumes

Kind: Read.

Flag Type Required
--name string
--page int
--size int
vngcloud volume list-volumes

list-volumes-by-server

Kind: Read.

Flag Type Required
--server-id string yes
vngcloud volume list-volumes-by-server --server-id <server-id>

quote-create-volume

Kind: Read.

Never orders anything: prices the volume CreateVolumeInput describes without sending a create. OptimumPrice and every other price are VND a month, one prepaid period. Needs only --zone-id, --size, and --volume-type-id; --name is optional here and required by create-volume. The CLI does not send --name or any other unpriced field to the billing gateway. Ignores MaxPrice and NoWait even when an inline --cli-input-json value sets them: both govern only an actual create.

--encryption-type-id creates an encrypted volume. The ID comes from volume list-encryption-types: aes-xts-plain64_128 or aes-xts-plain64_256. An unknown ID is refused by the server. An encrypted volume costs the same price as a plain one of the same size and type, live. Read the encryption type back with volume get-volume; get-underlying-volume does not carry it. Prices are VND totals that include VAT; the API gives no VAT breakdown.

Flag Type Required
--name string
--zone-id string yes
--size int yes
--volume-type-id string yes
--encryption-type-id string
--auto-renew bool
MaxPrice (via --cli-input-json only) float64
NoWait (via --cli-input-json only) bool
vngcloud volume quote-create-volume --zone-id <zone-id> --size <size> --volume-type-id <volume-type-id>

quote-resize-volume

Kind: Read.

Reads the volume first, on every call, for its current size and type, then prices the grow --size describes without sending it. OptimumPrice and every other price are VND a month. Ignores MaxPrice and NoWait even when an inline --cli-input-json value sets them: both govern only an actual resize. Prices are VND totals that include VAT; the API gives no VAT breakdown.

Flag Type Required
--volume-id string yes
--size int yes
MaxPrice (via --cli-input-json only) float64
NoWait (via --cli-input-json only) bool
vngcloud volume quote-resize-volume --volume-id <volume-id> --size <size>

resize-volume

Kind: Write, destructive.

Needs --yes: a resize can charge more, and this design only grows a volume. Sends nothing above --max-price, default 0: a bare resize-volume refuses with error code PriceAboveMax until --max-price is raised to at least the quoted price. Refuses, before any request, with error code InvalidUsage when --size is at or below the volume's current size, since shrinking would cut off the end of the data, and with error code UnexpectedStatus when the volume is neither AVAILABLE nor IN-USE. Resends the volume's own current volume type, so a type never changes by accident. The resize is sent at most once and never retried after a failure that may have already reached the server; check get-volume rather than repeating this command, since a repeat risks a second charge. Without --no-wait, waits up to 5 minutes for a read showing the new size with Status AVAILABLE or IN-USE; ERROR during that wait is WriteFailed, and the bound running out is NotSettled either way, check get-volume rather than repeating this command. The filesystem inside a server that has this volume attached must still be grown separately; this command only grows the block device.

If this resource is managed by OpenTofu or Terraform, a write made here drifts from that tracked state; keep such a resource's writes in the tool that manages it. Prices are VND totals that include VAT; the API gives no VAT breakdown.

Flag Type Required
--volume-id string yes
--size int yes
--max-price float64
--no-wait bool
vngcloud volume resize-volume --volume-id <volume-id> --size <size> --yes

Clone this wiki locally