All Products
Search
Document Center

Elastic Compute Service:CreateSnapshot

Last Updated:Dec 16, 2024

The retention period of the snapshot. Valid values: 1 to 65536. Unit: days. The snapshot is automatically released when its retention period expires. This parameter is empty by default, which indicates that the snapshot is not automatically released.

Operation description

The local snapshot feature is replaced by the instant access feature. Take note of the following items:

  • If you have used the local snapshot feature before December 14, 2020, you can use Category.
  • If you have not used the local snapshot feature before December 14, 2020, new snapshots of your Enterprise SSD (ESSD) series disks are instantly available after creation without the need for additional configurations, regardless of whether the snapshots are manually or automatically created. ESSD-series disks include ESSDs, ESSD AutoPL disks, ESSD Entry disks, and Regional ESSDs. InstantAccess, InstantAccessRetentionDays, and DisableInstantAccess that are related to the instant access feature no longer take effect in API operations. Available is added to the DescribeSnapshots and DescribeSnapshotGroups operations to indicate whether snapshots are available.

Prerequisites:

  • Elastic Compute Service (ECS) Snapshot is activated. For more information, see Activate ECS Snapshot.

  • The disk for which you want to create a snapshot is in the In_use or Available state. Take note of the following items:

    • If the disk is in the In_use state, make sure that the ECS instance to which the disk is attached is in the Running or Stopped state.
    • If the disk is in the Available state, make sure that the disk was attached to an ECS instance. Snapshots cannot be created for disks that have never been attached to an ECS instance.
    • When you use a disk to create a dynamic extended volume or a RAID array, we recommend that you create a snapshot-consistent group and enable the application-consistent snapshot feature to back up data. When a business system involves multiple disks, you can create a snapshot-consistent group to ensure a consistent write order and the crash consistency of business system data. For more information, see Create a snapshot-consistent group and Create application-consistent snapshots.

When you create a snapshot, take note of the following items:

  • We recommend that you create snapshots during off-peak hours because snapshot creation degrades disk I/O performance by up to 10% and slows down data reads and writes.

  • If a snapshot is being created, you cannot use this snapshot to create a custom image by calling the CreateImage operation.

  • If operations are performed on the disk and incremental data is generated when a snapshot is being created, the incremental data is not included in the snapshot.

  • When a snapshot is being created for a disk that is attached to an ECS instance, do not perform operations that change the status of the instance, such as stopping or restarting the instance. Otherwise, the snapshot may fail to be created.

  • You cannot resize a disk for which a snapshot is being created. Wait until the snapshot is created before you resize the disk.

  • You can create snapshots for a disk that is in the Expired (Expired) state. If the release time scheduled for a disk arrives while a snapshot is being created for the disk, the snapshot is in the Creating (Creating) state and is deleted when the disk is released.

  • After you create snapshots, you are charged snapshot storage fees per region based on the total size of the snapshots that are stored in the region. For more information, see Snapshots .

  • In the following scenarios, you cannot create snapshots for a disk:

    • The number of manual snapshots of the disk has reached 256.
    • A snapshot is being created for the disk.
    • If the response contains {"OperationLocks": {"LockReason" : "security"}} when you query information about an ECS instance, the instance is locked for security reasons and no operations are allowed on the instance.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:CreateSnapshotcreate
*Disk
acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}
*Snapshot
acs:ecs:{#regionId}:{#accountId}:snapshot/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringYes

Creates a snapshot for a disk.

d-bp1s5fnvk4gn2tws0****
SnapshotNamestringNo

The name of the snapshot. The name must be 2 to 128 characters in length and start with a letter. The name can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

Note The name cannot start with http:// or https://. The name cannot start with auto because the names of automatic snapshots start with auto.
testSnapshotName
DescriptionstringNo

The cloud disk ID.

testDescription
RetentionDaysintegerNo

The retention period of the snapshot. Unit: days. Valid values: 1 to 65536. After the retention period ends, the snapshot is automatically released.

This parameter is left empty by default, which indicates that the snapshot is not automatically released.

30
CategorystringNo

The category of the snapshot. Valid values:

  • Standard: standard snapshot
  • Flash: local snapshot
Note This parameter is no longer used. By default, new standard snapshots of ESSDs are upgraded to instant access snapshots free of charge without the need for additional configurations. For more information, see Use the instant access feature.
Standard
ClientTokenstringNo

The retention period of the snapshot. Valid values: 1 to 65536. Unit: days. The snapshot is automatically released when its retention period expires.

This parameter is empty by default, which indicates that the snapshot is not automatically released.

123e4567-e89b-12d3-a456-426655440000
ResourceGroupIdstringNo

The snapshot type. Valid values:

  • Standard: standard snapshot
  • Flash: local snapshot
Note This parameter will be removed in the future. We recommend that you use the InstantAccess parameter to ensure future compatibility. This parameter and the InstantAccess parameter cannot be specified at the same time. For more information, see the "Description" section of this topic.
rg-bp67acfmxazb4p****
InstantAccessbooleanNo

Specifies whether to enable the instant access feature. Valid values:

  • true: enables the instant access feature. This feature can be enabled only for ESSDs.
  • false: does not enable the instant access feature. If InstantAccess is set to false, a standard snapshot is created.

Default value: false.

Note This parameter is no longer used. By default, new standard snapshots of ESSDs are upgraded to instant access snapshots free of charge without the need for additional configurations. For more information, see Use the instant access feature.
false
InstantAccessRetentionDaysintegerNo

The validity period of the instant access feature. When the validity period ends, the feature is disabled and the instant access snapshot is automatically released. This parameter takes effect only when InstantAccess is set to true. Unit: days. Valid values: 1 to 65535.

By default, the value of this parameter is the same as that of RetentionDays.

Note This parameter is no longer used. By default, new standard snapshots of ESSDs are upgraded to instant access snapshots free of charge without the need for additional configurations. For more information, see Use the instant access feature.
1
Tagarray<object>No

The tags to add to the snapshot.

objectNo

The validity period of the instant access feature. When the validity period ends, the feature is disabled and the IA snapshot is automatically released. This parameter takes effect only when InstantAccess is set to true. Unit: days. Valid values: 1 to 65535.

By default, the value of this parameter is the same as that of RetentionDays.

keystringNo

The tag key to add to the snapshot.

Note This parameter will be removed in the future. We recommend that you use the Tag.N.key parameter to ensure future compatibility.
null
KeystringNo

The key of tag N to add to the snapshot. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey
ValuestringNo

The value of tag N to add to the snapshot. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain http:// or https://.

TestValue
valuestringNo

The tag value to add to the snapshot.

Note This parameter will be removed in the future. We recommend that you use the Tag.N.Value parameter to ensure future compatibility.
null
StorageLocationArnstringNo

The value of tag N that you want to add to the snapshot. Valid values of N: 1 to 20. The tag value can be an empty string. It can be up to 128 characters in length and cannot start with acs: or contain http:// or https://.

null

Response parameters

ParameterTypeDescriptionExample
object
SnapshotIdstring

The ID of the snapshot.

s-bp17441ohwka0yuh****
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.KMSKeyId.NotFoundThe specified KMSKeyId does not exist.The specified KMSKeyId parameter does not exist.
400InvalidSnapshotName.MalformedThe specified SnapshotName is wrongly formed.The format of the specified snapshot name is invalid.
400IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
400DiskCategory.OperationNotSupportedThe type of the specified disk does not support creating a snapshot.The operation is not supported by the current disk category.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.The specified tag key already exists. Tag keys must be unique.
400InvalidTagKey.MalformedThe specified Tag.n.Key is not valid.The specified Tag.N.Key parameter is invalid.
400InvalidTagValue.MalformedThe specified Tag.n.Value is not valid.The specified tag value is invalid.
400InvalidRetentionDays.MalformedThe specified RetentionDays is not valid.The specified RetentionDays parameter is invalid.
400CreateSnapshot.FailedThe process of creating snapshot is failed.Failed to create the snapshot.
403ThrottlingRequest was denied due to user flow control.-
403IncorrectDiskStatus.CreatingSnapshotA previous snapshot creation is in process.A previous snapshot creation task is in process. Please try again later.
403InstanceLockedForSecurityThe disk attached instance is locked due to security.The instance to which the disk is attached is locked for security reasons.
403IncorrectDiskStatus.NeverAttachedThe specified disk has never been attached to any instance.The removable disk has never been attached to instances and its content remains unchanged.
403QuotaExceed.SnapshotThe snapshot quota exceeds.The maximum number of snapshots has been reached. Delete snapshots that are no longer needed and try again.
403IncorrectDiskStatus.NeverUsedThe specified disk has never been used after creating.The disk has never been used and its data remains unchanged.
403DiskInArrearsThe specified operation is denied as your disk has expired.The disk has expired due to an overdue payment.
403DiskId.ValueNotSupportedThe specified parameter diskid is not supported.The specified EBS device category does not support the operation.
403IncorrectDiskStatusThe current disk status does not support this operation.The disk is in a state that does not support the current operation. Make sure that the disk is available and that your account has no overdue payments.
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
403InvalidAccountStatus.SnapshotServiceUnavailableSnapshot service has not been opened yet.The operation is not supported while the snapshot service is not activated.
403IncorrectVolumeStatusThe current volume status does not support this operation.-
403IdempotentParameterMismatchThe specified clientToken is used.The specified client token is already in use.
403IncorrectDiskStatus.InvalidThe specified disk status invalid, restart instance and try again.The state of the specified disk is invalid. Restart the instance and try again.
403IncorrectDiskType.NotSupportThe specified device type is not supported.The specified disk type does not support the operation.
403IncorrectDiskStatus.TransferringThe specified device is transferring, you can retry after the process is finished.The specified disk is being migrated. Wait until the migration is complete and try again.
403InvalidParameter.KMSKeyId.CMKUnauthorizedECS tags must be added to the CMK.ECS tags must be added to the CMK.
403InvalidParameter.KMSKeyId.CMKNotEnabledThe CMK needs to be enabled.The customer master key (CMK) is not enabled when KMSKeyId is specified for an encrypted disk. You can call the DescribeKey operation of KMS to query information about the specified CMK.
403InvalidParameter.KMSKeyId.KMSUnauthorizedECS service have no right to access your KMS.ECS is not authorized to access your KMS resources.
403IdempotentProcessingThe previous idempotent request(s) is still processing.A previous idempotent request is being processed. Try again later.
403QuotaExceed.Tags%sThe number of specified tags exceeds the upper limit. %s is a variable. An error message is dynamically returned based on call conditions.
403InvalidSnapshotCategory.MalformedThe specified Category is not valid.The specified Category parameter is invalid.
403InvalidAction.UnauthorizedThe specified action is not valid.The specified operation is invalid.
403InvalidRegion.NotSupportSnapshotInstantAccessRegionThe snapshot InstantAccess is not supported for this region.-
403InvalidCategoryAndInstantAccess.MalformedThe snapshot Category and InstantAccess can't be used together.-
403DISK_HAS_CREATING_SNAPSHOTThe operation cannot be performed while a snapshot is being created for the disk.The operation cannot be performed while a snapshot is being created for the disk.
403HibernationConfigured.InstanceOperationForbiddenThe operation is not permitted due to limit of the hibernation configured instance.The operation cannot be performed due to the limitations of instances for which the instance hibernation feature is enabled.
403QuotaExceed.SnapshotQuotaThe quota is insufficient, please contact your channel partner to increase the quota.The quota is insufficient. Contact your channel partner to request a quota increase.
403InvalidInstantAccessRetentionDays.MalformedThe specified InstantAccessRetentionDays is not valid.-
403CloudBoxNotSupportSnapshotWithInstantAccessThe specified disk in CloudBox does not support to create a snapshot with InstantAccess.-
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance to order postpaid product.Your account balance should not be less than 100 yuan to order postpaid product. Please recharge before ordering.
403InvalidOperation.UnfinishedEncryptedSnapshotCopyThis disk has unfinished encrypted copy snapshots in the target region.The cloud disk has unfinished encrypted snapshot copy tasks.
403QuotaExceed.ConcurrentSnapshotQuotaThe 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.The number of snapshots being created for this disk has exceeded the concurrent quota. Please wait for the previous snapshots to complete before trying again.
404InvalidDiskId.NotFoundThe specified DiskId does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404InvalidDescription.MalformedThe specified description is wrongly formed.The resource description is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
404InvalidVolumeId.NotFoundThe specified volume does not exist.The specified Shared Block Storage device does not exist.
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.The specified resource group does not exist.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-10-22The Error code has changedView Change Details
2024-10-08The Error code has changedView Change Details
2023-08-01The Error code has changedView Change Details
2023-03-30The Error code has changedView Change Details
2023-03-22The Error code has changedView Change Details