You can call this operation to apply 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 replace the original policy to take effect on the disk.

Description

  • A disk can have only one automatic snapshot policy.
  • A single automatic snapshot policy can be applied to multiple disks.

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
regionId String Yes cn-hangzhou

The ID of the region to which the automatic snapshot policy and the disk belong. You can call the DescribeRegions operation to query the most recent region list.

autoSnapshotPolicyId String Yes p-233e6yl**

The ID of the automatic snapshot policy to apply.

diskIds String Yes ["d-233e6yl**", "d-23vbpbi**", "d-23vasz3**"]

The IDs of one or more disks. The value is a JSON array. Separate multiple disk IDs with commas (,).

Action String No ApplyAutoSnapshotPolicy

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

Response parameters

Parameter 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-233e6yl**
&diskIds=["d-233e6yl**", "d-23vbpbi**", "d-23vasz3**"]
&regionId=cn-hangzhou
&<Common request parameters>

Sample success responses

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 because 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 region. The error message returned because the specified automatic snapshot policy does not exist in this region. Check whether the policy is correct.
404 InvalidDiskId.NotFound The specified disk does not exist in the region. The error message returned because the specified disk does not exist in the current region.
403 ParameterInvalid The specified RegionId parameter is invalid. The error message returned because the specified RegionId parameter is invalid.
403 ParameterInvalid The specified AutoSnapshotPolicyId parameter is invalid. The error message returned because the specified AutoSnapshotPolicyId parameter is invalid.
403 ParameterInvalid The specified DiskIds are invalid. The error message returned because the specified DiskIds parameter is invalid.
400 DiskCategory.OperationNotSupported The type of the specified disk does not support creating a snapshot. The error message returned because the operation is not supported by the current disk category.
400 PartofDiskCategory.OperationNotSupported The types of some disks in the disk list do not support creating snapshots. The error message returned because some of the specified disks does not support this operation.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. You must top up your account before proceeding.
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.

For a list of error codes, visit the API Error Center.