ec2.snapshots.create

Snapshot a volume

POST /ec2/api/volumes/{id}/snapshotsIAM ec2:CreateSnapshotChanges state

Answers 202; poll the snapshot until `state` is `completed`. A helper machine of the platform attaches the volume and copies its raw blocks in 4 MiB chunks to the zone’s snapshot storage; an encrypted volume is copied as LUKS ciphertext, so the helper never holds its key. Unchanged chunks are stored once, so a second snapshot stores only what changed (`newBytes`). An attached volume is refused with 409 unless `stopInstance` is true: the instance is stopped, the volume copied, reattached and the instance started again (needs `ec2:StopInstances` on it).

Request syntax

POST /ec2/api/volumes/{id}/snapshots
{
  "name": "string",
  "description": "string",
  "stopInstance": "boolean",
  "tags": "map of string"
}

Path parameters

  • idRequired

    string

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

Request body

  • nameOptional

    string

    A display name; omitted: none

    Constraints: 1-64 chars

  • descriptionOptional

    string

    Free text; omitted: none

    Constraints: max 255 chars

  • stopInstanceOptional

    boolean

    The volume is attached: stop its instance for the snapshot and start it after

    Default: false

  • tagsOptional

    map of string

    Tags for the new resource, e.g. {"env": "prod", "project": "shop"}. Keys your organization marks required must be present, or the create is refused with the missing keys (GET /tags/api/keys lists them).

    Constraints: key=value

Response

202: `data` is the new snapshot (fields as listed), not yet `completed`; poll it for progress.

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:CreateSnapshot 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 snapshots create id

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