Create a snapshot

Last Updated: Jul 25, 2017


This feature allows you to create a snapshot of a specified disk storage device. When creating a snapshot, consider the following:

  • A snapshot can only be created when the ECS status is Stopped or Running. However, snapshots cannot be created for newly created instances that have not been activated.
  • If you create a snapshot immediately after creating an ECS system disk or after you add a data disk by using a snapshot, an error will be returned. This is because the system disk or data disk has not finished loading data. Usually, a snapshot can be created 1 hour after system disk creation. The time after which a data disk snapshot can be created depends on the amount of disk data.
  • After a disk is added, if the instance has never been started, the added disk cannot be used to create snapshots.
  • If snapshot creation is incomplete (that is, the progress bar has not reached 100%), this snapshot cannot be used to create a user-defined image.
  • If snapshot creation is incomplete (that is, the progress bar has not reached 100%), you may not create another snapshot of the same disk.
  • The snapshot quota is determined by the total number of disks owned by the account. The maximum number of snapshots you can create is the number of disks multiplied by 64. For example, in the case of two disks, you can have 2 x 64 = 128 snapshots.
  • If the status of the disk is In_use and the OperationLocks of the instance it is attached to indicates LockReason: security, a snapshot cannot be created.
  • The instance where a disk is mounted must be started once before the disk can be used to create snapshots.
  • If a created independent basic cloud disk has never been mounted, an error message is displayed when you create snapshots.

Request parameters

Name Type Required Description
Action String Yes Value: CreateSnapshot.
DiskId String Yes Indicates the ID of the specified disk.
SnapshotName String No The name of a snapshot instance can be 2 to 128 characters in length and:
  • Must begin with an uppercase or lowercase letter, or a Chinese character.
  • Can contain digits, underscore (_), and hypen (-).
  • Cannot begin with auto (snapshot names starting with auto are reserved for auto snapshots).
  • Cannot begin with http:// or https://.
The snapshot name will be displayed on the console.
Description String No The description of a snapshot can be 2 to 256 characters in length and cannot begin with http:// or https://. The description will appear on the console. By default, the value is zero. If a value for this parameter is not specified, the default value will be used.
ClientToken String No Used to ensure the idempotence of the request. The value is generated by a client. The token must be unique among all requests and can contain up to 64 ASCII characters. For details, refer to the appendix How to Ensure Idempotence.

Return parameters

Name Type Description
SnapshotId String The snapshot ID.

Error code

Error code Description Http status code Meaning
MissingParameter The input parameter DiskId that is mandatory for processing this request is not supplied. 400 The required DiskId parameter is missing.
InvalidDiskId.NotFound The specified DiskId does not exist. 404 The specified disk does not exist.
InvalidSnapshotName.Malformed The specified SnapshotName is wrongly formed. 400 The SnapshotName format is invalid.
InvalidDescription.Malformed The specified description is wrongly formed. 404 The Description format is invalid.
IncorrectInstanceStatus The current status of the resource does not support this operation. 400 The status of the specified instance is incorrect.
IncorrectDiskStatus.CreatingSnapshot A previous snapshot creation is in process. 403 A snapshot of the specified disk is being created.
InstanceLockedForSecurity The disk attached instance is locked due to security. 403 The specified instance has a safety lock.
IncorrectDiskStatus.NeverAttached The specified disk has never been attached to any instance. 403 The portable basic cloud disk has not been attached since creation, so the content has not changed.
QuotaExceed.Snapshot The maximum number of snapshots is exceeded. 403 The snapshot quota has been reached.
IncorrectDiskStatus.NeverUsed The specified disk has never been used after creating. 403 The disk has not been used since creation, so the content has not changed.
CreateSnapshot.Failed The process of creating snapshot is failed. 403 Snapshot creation has failed.


Request example

  2. &DiskId=1033-60053321
  3. &<Public Request Parameters>

Return example

XML format

  1. <CreateSnapshotResponse>
  2. <RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
  3. <SnapshotId>s-923FE2BF0</SnapshotId>
  4. </CreateSnapshotResponse>

JSON format

  1. {
  2. "RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
  3. "SnapshotId": "s-923FE2BF0"
  4. }
Thank you! We've received your feedback.