Creates a snapshot-consistent group for the disks of an Elastic Compute Service (ECS) instance. A snapshot-consistent group contains snapshots of one or more disks.

Description

You can specify InstanceId to create a snapshot-consistent group for the specified disks of an instance. You can also specify DiskId.N to create a snapshot-consistent group for multiple disks that are attached to multiple instances within the same zone.

Note You cannot specify both DiskId.N and ExcludeDiskId.N. If InstanceId is set, you can use DiskId.N to specify only disks attached to the instance specified by InstanceId. You cannot use DiskId.N to specify disks attached to multiple instances.

When you call this operation, take note of the following items:

  • The disk for which you want to create a snapshot must be in the In Use (In_use) or Unattached (Available) state.
    • If the disk is in the In Use (In_use) state, the instance to which the disk is attached must be in the Running (Running) or Stopped (Stopped) state.
    • If the disk is in the Unattached (Available) state, make sure that the disk has been attached to an ECS instance. Snapshots cannot be created for disks that have never been attached to ECS instances.
  • The snapshot-consistent group feature can be used to create snapshots only for enhanced SSDs (ESSDs).
  • A single snapshot-consistent group can contain snapshots of up to 16 disks including the system disk and data disks and cannot exceed 32 TiB in size.
  • Snapshots that you created by using the snapshot-consistent group feature are retained until they are deleted. We recommend that you delete unnecessary snapshots on a regular basis to prevent them from incurring excessive fees.
  • Snapshot-consistent groups cannot be created for disks that have the multi-attach feature enabled. If disks that have the multi-attach feature enabled are attached to an instance, you must set the ExcludeDiskId.N parameter to exclude these disks.

For information about the snapshot-consistent group feature and its billing, see Create a snapshot-consistent group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateSnapshotGroup

The operation that you want to perform. Set the value to CreateSnapshotGroup.

RegionId String Yes cn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

InstanceId String No i-j6ca469urv8ei629****

The ID of the instance.

InstantAccess Boolean No false

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

  • true: enables the instant access feature.
  • false: disables the instant access feature.

Default value: false.

InstantAccessRetentionDays Integer No 1

Specify the number of days for which the instant access feature is available. Unit: days. Valid values: 1 to 65535.

This parameter takes effect only when InstantAccess is set to true. The instant access feature is automatically disabled when the specified duration of the instant access feature expires.

This parameter is empty by default, which indicates that the expiration time of the instant access feature is determined by the time when snapshots are released.

Name String No testName

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

Description String No This is description.

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

StorageLocationArn String No null
Note This parameter is unavailable for use.
ExcludeDiskId.N String No d-j6cf7l0ewidb78lq****

The ID of disk N for which you do not need to create snapshots. After this parameter is specified, the created snapshot-consistent group does not contain snapshots of the disk. Valid values of N: 1 to 16.

This parameter is empty by default, which indicates that snapshots are created for all the disks of the instance.

Note You cannot specify both ExcludeDiskId.N and DiskId.N.
DiskId.N String No d-bp1bcpqxahucdrcn****

The ID of disk N for which you want to create snapshots. You can specify multiple disk IDs across instances with the same zone. Valid values of N: 1 to 16. A single snapshot-consistent group can contain snapshots of up to 16 disks and cannot exceed 32 TiB in size.

Take note of the following items:

  • You cannot specify both DiskId.N and ExcludeDiskId.N.
  • If InstanceId is set, you can use DiskId.N to specify only disks attached to the instance specified by InstanceId, and you cannot use DiskId.N to specify disks attached to multiple instances.
Tag.N.Key String No TestKey

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

Tag.N.Value String No TestValue

The value of tag N of the snapshot-consistent group. 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:. It cannot contain http:// or https://.

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the snapshot-consistent group belongs.

Response parameters

Parameter Type Example Description
SnapshotGroupId String ssg-j6ciyh3k52qp7ovm****

The ID of the snapshot-consistent group.

RequestId String 01ABBD93-1ABB-4D92-B496-1A3D20EC0697

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateSnapshotGroup
&InstanceId=i-j6ca469urv8ei629****
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateSnapshotGroupResponse>
    <RequestId>01ABBD93-1ABB-4D92-B496-1A3D20EC0697</RequestId>
    <SnapshotGroupId>ssg-j6ciyh3k52qp7ovm****</SnapshotGroupId>
</CreateSnapshotGroupResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "01ABBD93-1ABB-4D92-B496-1A3D20EC0697",
  "SnapshotGroupId" : "ssg-j6ciyh3k52qp7ovm****"
}

Error codes

HTTP status code Error code Error message Description
400 InvalidSnapshotName.Malformed The specified SnapshotName is wrongly formed. The error message returned because the specified snapshot name is invalid.
400 IncorrectInstanceStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource is in the current state.
400 DiskCategory.OperationNotSupported The operation is not supported to the specified disk due to its disk category The error message returned because the specified disk category does not support this operation.
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The error message returned because the specified tag key already exists. Tag keys must be unique.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The error message returned because the specified Tag.N.Key parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The error message returned because the specified Tag.N.Value parameter is invalid.
400 InvalidRetentionDays.Malformed The specified RetentionDays is not valid. The error message returned because the specified RetentionDays parameter is invalid. Check whether the RetentionDays value is correct.
400 InvalidParameter.Name The specified Name is invalid. The error message returned because the specified Name parameter is invalid.
403 IncorrectDiskStatus.CreatingSnapshot A previous snapshot creation is in process. The error message returned because another snapshot is being created for the disk. Wait until the snapshot is created and try again.
403 InstanceLockedForSecurity The disk attached instance is locked due to security. The error message returned because the instance to which the disk is attached is locked for security reasons.
403 IncorrectDiskStatus.NeverAttached The specified disk has never been attached to any instance. The error message returned because the removable disk has never been attached to instances and its content remains unchanged.
403 QuotaExceed.Snapshot The snapshot quota exceeds. The error message returned because the maximum number of snapshots has been reached. To create snapshots, delete snapshots that are no longer needed.
403 IncorrectDiskStatus.NeverUsed The specified disk has never been used after creating. The error message returned because the specified disk has never been used and its content remains unchanged.
403 CreateSnapshot.Failed The process of creating snapshot is failed. The error message returned because the snapshot fails to be created.
403 DiskInArrears The specified operation is denied as your disk has expired. The error message returned because the disk has expired due to an overdue payment.
403 DiskId.ValueNotSupported The specified parameter diskid is not supported. The error message returned because the category of the specified Elastic Block Storage (EBS) device does not support this operation.
403 IncorrectDiskStatus The current disk status does not support this operation. The error message returned because the operation is not supported while the disk is in the current state. Make sure that the disk is usable and you have no overdue payments for it.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. Add funds to your account and try again.
403 InvalidAccountStatus.SnapshotServiceUnavailable Snapshot service has not been opened yet. The error message returned because the operation is not supported while the snapshot service is not activated.
403 IncorrectVolumeStatus The current volume status does not support this operation. The error message returned because the operation is not supported while the Shared Block Storage device is in the current state.
403 IdempotentParameterMismatch The specified clientToken is used. The error message returned because the specified client token is already in use.
403 IncorrectDiskType.NotSupport The specified device type is not supported. The error message returned because the specified disk type does not support this operation.
403 IncorrectDiskStatus.Transferring The specified device is transferring, you can retry after the process is finished. The error message returned because the specified disk is being migrated. Wait until the disk is migrated and try again.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled. The error message returned because the customer master key (CMK) is not enabled when a Key Management Service (KMS) key ID is specified for a disk. You can call the DescribeKey operation of KMS to query the information about the specified CMK.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. The error message returned because ECS is not authorized to access your KMS resources.
403 IdempotentProcessing The previous idempotent request(s) is still processing. The error message returned because a previous idempotent request is being processed. Try again later.
403 QuotaExceed.Tags %s The error message returned because the maximum number of tags has been reached. %s is a variable. An error message is dynamically returned based on call conditions.
403 InvalidSnapshotCategory.Malformed The specified Category is not valid. The error message returned because the specified Category parameter is invalid. Check whether the specified Category parameter is valid.
403 NumberExceed.TooManyDisks The number of all disks in the request exceeds. The error message returned because the number of specified disks exceeds the limit.
403 InvalidOperation.MultiAttachDisk Multi attach disk does not support this operation. The error message returned because the disk that has the multi-attach feature enabled does not support the operation.
403 IncorrectDiskStatus.Invalid The specified disk status invalid, restart instance and try again. The error message returned because the state of the specified disk is invalid. Restart the instance and try again.
404 InvalidDiskId.NotFound The specified DiskId does not exist. The error message returned because the specified DiskId parameter does not exist. Check whether the disk ID is correct.
404 InvalidDescription.Malformed The specified description is wrongly formed. The error message returned because the specified Description parameter is invalid. The description must be 2 to 256 characters in length and cannot start with http:// or https://.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter is invalid.
404 InvalidVolumeId.NotFound The specified volume does not exist. The error message returned because the specified Shared Block Storage device does not exist. Check whether the Shared Block Storage device ID is correct.
404 InvalidRegionId.NotFound The specified RegionId does not exist. The error message returned because the specified RegionId parameter is invalid.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an internal error has occurred. Try again later.

For a list of error codes, see Service error codes.