All Products
Search
Document Center

Elastic Compute Service:CreateSnapshot

Last Updated:Nov 14, 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 the Category parameter.
  • 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. The InstantAccess, InstantAccessRetentionDays, and DisableInstantAccess parameters that are related to the instant access feature no longer take effect in API operations. The Available parameter is added to the DescribeSnapshots and DescribeSnapshotGroups operations to indicate whether snapshots are available.

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.
  • The Elastic Compute Service (ECS) 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 (Stopped) or Running (Running) state.
  • 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.

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 ECS instance, do not change the instance state.
  • 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.

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. The name must start with a letter and cannot start with http:// or https://. The name can contain letters, digits, colons (:), underscores (_), periods (.), and hyphens (-).

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

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