All Products
Search
Document Center

Elastic Compute Service:CreateSnapshot

Last Updated:Mar 19, 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 request ID.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringYes

Creates a snapshot for a disk.

d-bp1s5fnvk4gn2tws0****
SnapshotNamestringNo

The local snapshot feature is replaced by the instant access feature. Parameter description:

  • If you used the local snapshot feature before December 14, 2020, you can use the Category or InstantAccess parameter as expected and must take note of the following items:

    • The Category and InstantAccess parameters cannot be specified at the same time.
    • If neither the Category nor InstantAccess parameters is specified, normal snapshots are created.
  • If you did not use the local snapshot feature before December 14, 2020, you can use the InstantAccess parameter but cannot use the Category parameter.

You cannot create snapshots for a disk in the following scenarios:

  • The number of manual snapshots of the disk has reached 256.
  • A snapshot is being created for the disk.
  • The instance to which the disk is attached has never been started.
  • The ECS instance to which the disk is attached is not in the Stopped or Running state.````
  • If the response contains {"OperationLocks": {"LockReason" : "security"}}, the instance is locked for security reasons. No operations are allowed on the instance.

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

  • If a snapshot is being created, you cannot use this snapshot to create a custom image by calling the CreateImage operation.
  • When a snapshot is being created for a disk that is attached to an instance, do not change the instance state.
  • You can create snapshots for a disk that is in the 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** state and is deleted when the disk is released.
testSnapshotName
DescriptionstringNo

The cloud disk ID.

testDescription
RetentionDaysintegerNo

The snapshot name. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

The name cannot start with auto because snapshots whose names start with auto are recognized as automatic snapshots.

30
CategorystringNo

The description of the snapshot. The description must be 2 to 256 characters in length and cannot start with http:// or https://.

By default, this parameter is left empty.

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: normal 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

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique across requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

false
InstantAccessRetentionDaysintegerNo

The ID of the resource group to which to assign the snapshot.

1
Tagobject []No

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

  • true: enables the instant access feature. This feature can be enabled only for enhanced SSDs (ESSDs).

    **

    NoteAfter the instant access feature is enabled, an instant access (IA) snapshot is created and can be used to roll back disks or create disks across zones even when the snapshot is being created. This feature ensures that a new ESSD snapshot is available for use as soon as possible regardless of its size.

  • false: does not enable the instant access feature. If InstantAccess is set to false, a normal snapshot is created.

Default value: false.

Note This parameter and the Category parameter cannot be specified at the same time. For more information, see the "Description" section of this topic.
keystringNo

The list of tags.

null
KeystringNo

The tags to add to the snapshot.

TestKey
ValuestringNo

The tag key to add to the snapshot.

Note This parameter will be deprecated in the future. We recommend that you use the Tag.N.key parameter to ensure future compatibility.
TestValue
valuestringNo

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

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
The current API has no return parameters

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.-
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.
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
2023-08-01The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 404 change
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 500
2023-03-30The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    delete Error Codes: 404
    delete Error Codes: 500
2023-03-22The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 403 change
    delete Error Codes: 400
    delete Error Codes: 404
    delete Error Codes: 500