CreateSnapshot - 创建快照

更新时间:
复制 MD 格式

为一块云盘创建一份快照。

接口说明

原本地快照更替为快照极速可用能力。参数说明如下:

  • 如果您在 2020 年 12 月 14 日之前使用过本地快照,您可以正常使用参数Category。

  • 如果您在 2020 年 12 月 14 日之前未使用过本地快照,无需额外进行配置,ESSD 系列云盘(ESSD、ESSD AutoPL、ESSD Entry 和 ESSD 同城冗余)新建的快照将默认为创建后极速可用,且同时支持手动快照和自动快照。API 接口中的“InstantAccess”、“InstantAccessRetentionDays”、“DisableInstantAccess”三个极速可用功能相关参数不再生效,“DescribeSnapshots”、“DescribeSnapshotGroups”这两个 API 接口将新增出参 Available 来描述快照可用的状态。

前提条件:

  • 已开通快照。具体操作,请参见开通快照。

  • 云盘必须处于使用中或待挂载状态。不同状态下的注意事项如下:

    • 如果云盘处于使用中的状态,则实例必须处于运行中或已停止状态。

    • 如果云盘处于待挂载的状态,则需要保证云盘有过挂载到 ECS 实例的历史操作。从未挂载过 ECS 实例的云盘不支持创建快照。

    • 当云盘被用作创建动态扩展卷或者 RAID 阵列时,建议您使用快照一致性组并开启应用一致性快照备份数据。快照一致性组能够保证在业务系统跨多块云盘的场景下,数据写入云盘的时序一致性,并保证其崩溃一致性。更多信息,请参见创建快照一致性组和创建应用一致性快照。

创建快照时,您需要注意:

  • 创建快照应避开业务高峰期。创建快照时,云盘 I/O 性能降低 10%以内,读写性能出现短暂瞬间变慢。

  • 如果创建快照还未完成,这份快照无法用于创建自定义镜像( CreateImage )。

  • 创建快照期间,操作云盘产生的增量数据不会备份到快照中。

  • 如果云盘已挂载到 ECS 实例上,创建快照期间请勿变更实例状态,如停止或重启 ECS 实例,否则会导致快照创建失败。

  • 正在创建快照的云盘不支持扩容。请您等待快照创建完成后,再开始执行扩容操作。

  • 支持对处于已过期(Expired)状态的云盘创建快照。若创建快照时云盘正好达到过期释放时间,云盘被释放的同时也会删除创建中(Creating)的快照。

  • 创建快照后,系统根据快照容量大小,按每个地域单独结算费用。更多信息,请参见快照计费

  • 以下场景中,您无法为指定的云盘创建快照:

    • 云盘保留的手动快照数达到上限。更多信息,请参见快照使用限制。

    • 创建快照存在并发限制,超过限制会导致创建失败。更多信息,请参见快照使用限制。

    • 查询 ECS 实例信息时,如果返回数据中包含{"OperationLocks": {"LockReason" : "security"}},则禁止一切操作。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

ecs:CreateSnapshot

create

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

*Snapshot

acs:ecs:{#regionId}:{#accountId}:snapshot/*

无 无

请求参数

名称

类型

必填

描述

示例值

DiskId

string

是

云盘 ID。可以调用 DescribeDisks 并通过 InstanceId 筛选实例所挂载的云盘。用于创建快照的云盘必须处于使用中或待挂载状态;待挂载云盘必须曾挂载过 ECS 实例。

d-bp1s5fnvk4gn2tws0****

SnapshotName

string

否

快照的名称。长度为 2~128 个字符,必须以大小写字母或中文开头,支持 Unicode 中 letter 分类下的字符(其中包括英文、中文等),ASCII 数字(0-9)。可以包含半角冒号(:)、下划线(_)、半角句号(.)或者短划线(-)。

说明

不能以 http://和 https:// 开头。为防止和自动快照的名称冲突,不能以auto开头。

testSnapshotName

Description

string

否

快照的描述。长度为 2~256 个英文或中文字符,不能以http://或https://开头。

默认值:空。

testDescription

RetentionDays

integer

否

设置快照的保留时间,单位为天。取值范围:1~65536。保留时间到期后快照会被自动释放。

默认值:空,表示快照不会被自动释放。

30

Category

string

否

快照类型。取值范围:

  • Standard:标准快照。

  • Flash:本地快照。

说明

该参数即将被弃用。ESSD 云盘标准快照已升级为默认极速可用,您无需额外配置,且不产生额外花销。

Standard

ClientToken

string

否

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符,且不能超过 64 个字符。更多详情,请参见如何保证幂等性。

123e4567-e89b-12d3-a456-426655440000

ResourceGroupId

string

否

快照所在的企业资源组 ID。

rg-bp67acfmxazb4p****

InstantAccess

boolean

否

是否开启快照极速可用功能。取值范围:

  • true:开启。仅 ESSD 云盘支持开启该功能。

  • false:关闭。即创建标准快照。

默认值:false。

说明

该参数已弃用。ESSD 云盘标准快照已升级为默认极速可用,您无需额外配置,且不产生额外花销。

false

InstantAccessRetentionDays

integer

否

设置快照极速可用功能的保留时间,保留时间到期后快照将自动释放。该参数在InstantAccess=true时生效。单位:天。取值范围:1~65535。

默认与参数RetentionDays的值一致。

说明

该参数已弃用。ESSD 云盘标准快照已升级为默认极速可用,您无需额外配置,且不产生额外花销。

1

Tag

array<object>

否

标签列表。

object

否

标签列表。

key

string

否

快照的标签键。

说明

为提高兼容性,建议您尽量使用 Tag.N.Key 参数。

null

Key

string

否

快照的标签键。N 的取值范围:1~20。一旦传入该值,则不允许为空字符串。最多支持 128 个字符,不能以 aliyun 和 acs:开头,不能包含 http://或者 https://。

TestKey

Value

string

否

快照的标签值。N 的取值范围:1~20。一旦传入该值,可以为空字符串。最多支持 128 个字符,不能包含 http://或者 https://。

TestValue

value

string

否

快照的标签值。

说明

为提高兼容性,建议您尽量使用 Tag.N.Value 参数。

null

StorageLocationArn

string

否

说明

该参数暂未开放使用。

null

返回参数

名称

类型

描述

示例值

object

SnapshotId

string

快照 ID。

s-bp17441ohwka0yuh****

RequestId

string

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

{
  "SnapshotId": "s-bp17441ohwka0yuh****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.
400 InvalidSnapshotName.Malformed The specified SnapshotName is malformed. Please ensure that the SnapshotName is 2 to 128 characters long and starts with a letter and does not start with "http://" or "https://" or auto and try again.
400 IncorrectInstanceStatus The current status of the resource does not support this operation. 该资源目前的状态不支持此操作。
400 DiskCategory.OperationNotSupported The type of the specified disk does not support creating a snapshot. 当前磁盘类型不支持此操作。
400 Duplicate.TagKey The specified Tag.N.Key contains a duplicate key. Please ensure that each tag key is unique.
400 InvalidTagKey.Malformed The specified Tag.N.Key is not valid. Please check the format and try again.
400 InvalidTagValue.Malformed The specified Tag.N.Value is not valid. Please check the format and try again.
400 InvalidRetentionDays.Malformed The specified RetentionDays is not valid. Please ensure that the value is an integer between 1 and 65536 and try again.
400 CreateSnapshot.Failed The process of creating snapshot is failed. 创建快照失败。
400 InvalidOperation.StorageLocationMismatch The specified StorageLocationArn does not match the storage location of the last snapshot for the disk. Please ensure that the StorageLocationArn is consistent with that of previous snapshots.
400 InvalidOperation.DiskReadOnlyNotSupportSnapshot The specified disk "%s" is a read-only disk. The snapshot operation is not supported. Please remove the read-only disk from the request and try again.
500 InternalError The request processing has failed due to an internal error and you may retry later or contact support with the request ID.
403 Throttling The request was denied due to request throttling. Please retry later.
403 IncorrectDiskStatus.CreatingSnapshot A snapshot creation for the specified disk is in progress. Please wait until it completes and try again.
403 InstanceLockedForSecurity Operation failed because the instance attached to this disk is locked for security reasons. Please open a ticket to contact our security team if you have any questions.
403 IncorrectDiskStatus.NeverAttached The specified disk has never been attached to any instance. Please attach the disk to an instance and try again.
403 QuotaExceed.Snapshot The snapshot limit for the specified disk has been exceeded. Please delete unnecessary snapshots of this disk and try again.
403 IncorrectDiskStatus.NeverUsed Failed to create snapshot because the specified disk is uninitialized. Please attach the disk to an instance and initialize it before creating a snapshot.
403 CreateSnapshot.Failed The process of creating snapshot is failed.
403 DiskInArrears The specified operation is denied as your disk has expired.
403 DiskId.ValueNotSupported The specified parameter diskid is not supported. 指定的块存储类型不支持此操作。
403 IncorrectDiskStatus The current disk status does not support this operation. Please ensure the disk is in the In_use or Available state and try again.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 InvalidAccountStatus.SnapshotServiceUnavailable The snapshot service has not been activated. Please activate it and try again.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 IncorrectVolumeStatus The current volume status does not support this operation. 共享块存储状态不支持当前操作。
403 IdempotentParameterMismatch The specified clientToken is used. 指定的客户令牌已经被使用。
403 IncorrectDiskStatus.Invalid The underlying device of the specified disk has not been created yet. Please ensure that the disk is attached to an instance and start or restart the instance before you retry.
403 IncorrectDiskType.NotSupport The specified device type is not supported. 指定磁盘存储类型不支持此操作。
403 IncorrectDiskStatus.Transferring The specified device is currently being transferred. Please try again after the transfer is complete.
403 InvalidParameter.KMSKeyId.CMKUnauthorized ECS tags must be added to the CMK. CMK 需要添加 ECS 标签。
403 InvalidParameter.KMSKeyId.CMKNotEnabled The specified KMS key must be in an enabled state. Please enable the key in the KMS console and try again.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
403 IdempotentProcessing The request is rejected because an operation with the same ClientToken is still processing. Please wait for the ongoing request to complete before retrying.
403 InvalidSnapshotCategory.Malformed The specified Category is not valid. Please set it to standard/archive and try again.
403 InvalidAction.Unauthorized The current account is not permitted to use advanced snapshot features. Please submit a ticket for assistance.
403 InvalidRegion.NotSupportSnapshotInstantAccessRegion The snapshot InstantAccess is not supported for this region.
403 InvalidCategoryAndInstantAccess.Malformed The snapshot Category and InstantAccess can't be used together.
403 DISK_HAS_CREATING_SNAPSHOT The operation cannot be performed while a snapshot is being created for the disk.
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance. 不符合开启休眠选项的实例的相关限制,操作不被允许。
403 QuotaExceed.SnapshotQuota The quota is insufficient. Please contact your channel partner to increase the quota.
403 InvalidInstantAccessRetentionDays.Malformed The specified InstantAccessRetentionDays is not valid. Please ensure that the value is an integer between 1 and 65536 and does not exceed RetentionDays and try again.
403 CloudBoxNotSupportSnapshotWithInstantAccess The specified disk in the CloudBox does not support InstantAccess snapshots. Please set InstantAccess to false and try again.
403 InvalidOperation.UnfinishedEncryptedSnapshotCopy This disk has unfinished encrypted copy snapshots in the target region. 云盘存在未完成的加密快照拷贝任务。
403 QuotaExceed.ConcurrentSnapshotQuota The number of snapshots being created for the disk %s has exceeded the concurrent quota (%s). Please wait for the previous snapshots to complete before trying again. 该磁盘正在创建的快照数量已超过并发配额,请等待之前的快照完成后再重试。
403 InvalidClientToken.Malformed The specified clientToken is improperly formatted. It must contain only ASCII characters and must not exceed 64 characters in length. 指定的参数ClientToken格式不符合规范要求,该参数应该只包括ASCII字符,且长度不应该超过64个字符。
403 InvalidParameter.UnauthorizedStorageLocationArn The operation has failed due to lack of permission for the specified "StorageLocationArn". Please use a resource with appropriate permission for the operation. 当前操作因为指定的StorageLocationArn权限不足失败,请联系该资源的管理员获取操作权限。
403 InvalidStorageLocationArn.Malformed The specified parameter StorageLocationArn is malformed. Please ensure that the value of StorageLocationArn is in the correct format and try again.
403 InvalidStatus.ResourceGroup You cannot perform an operation on a resource group that is being created or deleted. 资源组正在创建或删除时不允许操作。
403 OperationDenied.QuotaExceed The number of tags specified in this request exceeds the maximum limit for the resource. Please reduce the number of tags and try again.
403 Forbidden.InDebt The operation is not allowed because your account has an outstanding balance. Please settle the overdue payment and try again.
403 InvalidOperation.RegionUnsupported Creating snapshots is not supported in the specified region. Please use a region that supports the snapshot feature. 指定地域不支持创建快照。请使用支持快照功能的地域。
403 OperationDenied.KMSKeyUnauthorized The operation is denied due to missing KMS key authorization. Please check the KMS key permissions and ensure the key is properly authorized for this operation.
403 InvalidOperation.DiskNotSupportStorageLocation The specified disk does not support the specified StorageLocationArn because the disk is not in a cloud box. Please use a disk in the cloud box that matches the storage location and try again.
404 InvalidDiskId.NotFound The specified DiskId does not exist. Please verify the disk ID and the current region. 指定的DiskId不存在。请验证磁盘ID和当前地域。
404 InvalidDescription.Malformed The specified parameter Description is not valid. Please ensure that the description is 2 to 256 characters long and does not start with "http://" or "https://" and try again. 指定的参数Description无效。请确保描述信息长度为2 ~ 256个英文或中文字符,且不能以"http://"或"https://"开头,然后重试。
404 InvalidInstanceId.NotFound The instance to which the specified disk is attached does not exist. Please verify the DiskId and the current region and try again.
404 InvalidVolumeId.NotFound The specified DiskId does not exist. Please verify the DiskId and the current region and try again.
404 InvalidResourceGroup.NotFound The specified ResourceGroupId does not exist. Please verify the ResourceGroupId and try again.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。