Applies an automatic snapshot policy to one or more disks. If you apply an automatic snapshot policy to a disk that already has an automatic snapshot policy, the new policy will take effect on the disk and replace the original policy.

Description

When you call this operation, note that:

  • A disk can have only one automatic snapshot policy.
  • A single automatic snapshot policy can be applied to multiple disks.
  • If many automatic snapshot tasks are in progress at the same point in time, the tasks are queued for zero to three minutes for execution. These tasks may not be executed concurrently.

Debugging

You can use API Explorer to perform debugging. API Explorer allows you to perform various operations to simplify API usage. For example, you can retrieve APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Name Type Required Example Description
autoSnapshotPolicyId String Yes p-233e6ylv0

The ID of the automatic snapshot policy.

diskIds String Yes "d-233e6ylv0", "d-23vbpbi03", "d-23vasz3ds"

The IDs of the disks. To apply an automatic snapshot policy to multiple disks, you can set this parameter to an array of disk IDs separated with commas (,).

regionId String Yes cn-hangzhou

The ID of the region to which the automatic snapshot policy and the disk belong. You can call DescribeRegions to view the latest regions of Alibaba Cloud.

Action String No ApplyAutoSnapshotPolicy

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

Response parameters

Name Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ApplyAutoSnapshotPolicy
&autoSnapshotPolicyId=p-233e6ylv0
&diskIds=["d-233e6ylv0", "d-23vbpbi03", "d-23vasz3ds"]
&regionId=cn-hangzhou
&<Common request parameters>

Successful response examples

XML format

<ApplyAutoSnapshotPolicyResponse>
  <RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
</ApplyAutoSnapshotPolicyResponse>

JSON format

{
	"RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
}

Error codes

HTTP status code Error code Error message Description
404 ParameterInvalid The specified automatic snapshot policy does not exist. The error message returned when the specified automatic snapshot policy does not exist. Check whether the policy is correct.
404 ParameterInvalid The specified automatic snapshot policy does not exist in the The error message returned when the specified automatic snapshot policy does not exist. Check whether the policy is correct.
404 InvalidDiskId.NotFound The specified disk does not exist in the region. The error message returned when the specified disk does not exist in the current region.
403 ParameterInvalid The specified RegionId parameter is invalid. The error message returned when the specified value of the RegionId parameter is invalid.
403 ParameterInvalid The specified AutoSnapshotPolicyId parameter is invalid. The error message returned when the specified value of the AutoSnapshotPolicyId parameter is invalid.
403 ParameterInvalid The specified DiskIds are invalid. The error message returned when the specified value of the DiskIds parameter is invalid.
400 PartofDiskCategory.OperationNotSupported The types of some disks in the disk list do not support creating snapshots. The error message returned when some of the specified disks does not support this operation.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The error message returned when your account balance is insufficient. You must top up your account before proceeding.

View error codes