ec2.volumes.create

Create a volume in a region

POST /ec2/api/volumesIAM ec2:CreateVolumeChanges state

Encrypted (LUKS2, key per volume from KMS) unless `encrypted` is false. An encrypted volume opens at `/dev/mapper/ews-vol-<provider volume id>` on an instance launched with the volume helper; format and mount that device. `kmsKeyId` wraps the volume key under one of your KMS keys (needs `kms:Encrypt` on it); disabling or deleting that key makes the volume unopenable.

Request syntax

POST /ec2/api/volumes
{
  "name": "string",
  "sizeGib": "number",
  "regionId": "string",
  "availabilityZoneId": "string",
  "tags": "map of string",
  "encrypted": "boolean",
  "kmsKeyId": "string",
  "snapshotId": "string"
}

Request body

  • nameRequired

    string

    A display name

    Constraints: 1-64 chars

  • sizeGibRequired

    number

    Size in GiB; a restore needs at least the snapshot’s size

    Constraints: integer, 10-10000

  • regionIdRequired

    string

    The region to create it in, e.g. de1

    Constraints: min 1 chars

  • availabilityZoneIdOptional

    string

    The zone it lives in; it attaches only to instances there. Default de1a

    Constraints: /^[a-z]+[0-9]+[a-z]$/

  • tagsOptional

    map of string

    Tags for the volume; your organization’s required keys must be present

    Constraints: key=value

  • encryptedOptional

    boolean

    Encrypt the volume at rest with a key of its own, held in KMS (default true); a restore follows the snapshot instead

    Default: true

  • kmsKeyIdOptional

    string

    One of your KMS keys to wrap the volume key (needs kms:Encrypt on it); omitted: the platform key. Not with snapshotId

    Constraints: uuid

  • snapshotIdOptional

    string

    Restore this volume snapshot onto the new volume (same zone, at least its size)

    Constraints: /^snap-[0-9a-f]{6,32}$/

Response

201: `data` is the new volume, `available`, or `creating` while the provider (or a restore) finishes.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow ec2:CreateVolume on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud ec2 volumes create --name example --size-gib 1 --region-id example

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_ec2_volumes_create.