跳到主要内容

ecs snapshot

管理云盘快照

运行 ecctl ecs snapshot <action> -h 查看用法,或 ecctl schema ecs.snapshot.<action> --full 获取该命令完整的结构化规格——每个参数与行为,便于 Agent 读取和填参。

create

ecctl ecs snapshot create [flags]

创建快照

  • 类型:mutation · 风险:medium
  • 同步:等待 accomplished(waiter accomplished_after_create,超时 600s);用 --no-wait 跳过等待。
  • 通过 ClientToken 幂等。
API调用时机用途
CreateSnapshot每次执行命令时执行资源操作。
DescribeSnapshots未指定 --no-wait轮询等待资源达到目标状态。(重复调用)
DescribeSnapshots未指定 --no-wait返回最终资源视图。(复用等待结果,不额外请求)
参数类型必填说明
--diskstring源云盘 ID
--regionstringAlibaba Cloud region
--categorystring快照类型(普通/极速可用)
--descriptionstring快照描述
--instant-accessboolean启用极速可用
--instant-access-retention-daysinteger极速可用保留天数
--namestring快照名称
--resource-groupstring资源组 ID
--retention-daysinteger快照保留天数
--tagkey_value标签赋值 key=value

update

ecctl ecs snapshot update <id> [flags]

更新快照属性、类型或锁定状态

  • 类型:mutation · 风险:medium
API调用时机用途
ModifySnapshotAttribute指定 --name 或指定 --description 或指定 --disable-instant-access执行资源操作。
ModifySnapshotCategory指定 --category执行资源操作。
LockSnapshot指定 --lock执行资源操作。
UnlockSnapshot指定 --unlock执行资源操作。
OpenSnapshotService指定 --open-service执行资源操作。
DescribeSnapshots未指定 --no-wait读取资源视图。
参数类型必填说明
--regionstringAlibaba Cloud region
--categorystring快照类型(普通/极速可用)
--descriptionstring快照描述
--disable-instant-accessboolean更新时关闭极速可用
--lockboolean锁定快照以防删除
--namestring快照名称
--open-serviceboolean开通快照服务
--unlockboolean解锁快照

delete

ecctl ecs snapshot delete <id> [flags]

删除快照

  • 类型:mutation · 风险:high
  • 同步:等待 absent(waiter deleted_after_delete,超时 300s);用 --no-wait 跳过等待。
API调用时机用途
DeleteSnapshot每次执行命令时执行资源操作。
DescribeSnapshots未指定 --no-wait轮询等待资源达到目标状态。(重复调用)
参数类型必填说明
--regionstringAlibaba Cloud region
--forceboolean即使快照被云盘使用也强制删除(必须显式指定)(默认:false

get

ecctl ecs snapshot get <id> [flags]

获取快照

  • 类型:read · 风险:low
API调用时机用途
DescribeSnapshots每次执行命令时读取资源视图。
DescribeLockedSnapshots指定 --with-lock读取资源视图。
DescribeSnapshotLinks指定 --with-links读取资源视图。
DescribeSnapshotMonitorData指定 --with-monitor读取资源视图。
DescribeSnapshotPackage指定 --with-package读取资源视图。
DescribeSnapshotsUsage指定 --with-usage读取资源视图。
参数类型必填说明
--regionstringAlibaba Cloud region
--diskstring源云盘 ID
--end-timestring监控查询结束时间
--fieldsstring要包含的资源字段,使用逗号分隔
--instancestring源实例 ID
--periodinteger监控数据周期,单位秒
--start-timestring监控查询开始时间
--with-linksboolean附带快照链信息
--with-lockboolean附带快照锁定信息
--with-monitorboolean附带快照容量监控数据
--with-packageboolean附带 OSS 快照存储包信息
--with-usageboolean附带快照数量和容量

list

ecctl ecs snapshot list [<ids>...] [flags]

列出快照

  • 类型:read · 风险:low
API调用时机用途
DescribeSnapshots每次执行命令时读取资源视图。
参数类型必填说明
--regionstringAlibaba Cloud region
--fieldsstring要包含的资源字段,使用逗号分隔
--filterkey_value过滤表达式 key=value
--limitinteger最多返回资源数量(默认:100
--next-tokenstring下一页查询 token

copy

ecctl ecs snapshot copy <id> [flags]

跨地域复制快照

  • 类型:mutation · 风险:medium
  • 同步:等待 accomplished(waiter accomplished_after_copy,超时 600s);用 --no-wait 跳过等待。
  • 通过 ClientToken 幂等。
API调用时机用途
CopySnapshot每次执行命令时执行资源操作。
DescribeSnapshots未指定 --no-wait轮询等待资源达到目标状态。(重复调用)
参数类型必填说明
--destination-regionstring复制快照的目标地域
--regionstringAlibaba Cloud region
--destination-descriptionstring复制快照的目标描述
--destination-namestring复制快照的目标名称
--encryptedboolean复制快照时加密目标快照
--kms-key-idstring加密目标快照使用的 KMS 密钥 ID
--resource-groupstring资源组 ID
--retention-daysinteger快照保留天数
--tagkey_value标签赋值 key=value