All Products
Search
Document Center

:ApplyAutoSnapshotPolicy

最終更新日:Dec 05, 2023

Applies an automatic snapshot policy to disks. If you apply an automatic snapshot policy to a disk that already has an automatic snapshot policy, the new policy replaces the original policy on the disk.

Usage notes

  • You can apply only one automatic snapshot policy to each disk.
  • You can apply a single automatic snapshot policy 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

Action String Yes ApplyAutoSnapshotPolicy

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

regionId String Yes cn-hangzhou

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

autoSnapshotPolicyId String Yes sp-bp14yziiuvu3s6jn****

The ID of the automatic snapshot policy to apply.

diskIds String Yes ["d-bp14k9cxvr5uzy54****", "d-bp1dtj8v7x6u08iw****", "d-bp1c0tyj9tfli2r8****"]

The IDs of the disks. The value is a JSON array that consists of disk IDs. Separate the disk IDs with commas (,).

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=sp-bp14yziiuvu3s6jn****
&diskIds=["d-bp14k9cxvr5uzy54****", "d-bp1dtj8v7x6u08iw****", "d-bp1c0tyj9tfli2r8****"]
&regionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

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

JSON format

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

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

Error codes

HTTP status code

Error code

Error message

Description

400 DiskCategory.OperationNotSupported The type of the specified disk does not support creating a snapshot. 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. Some of the specified disks do not support this operation.
403 ParameterInvalid The specified RegionId parameter is invalid. Invalid RegionId value. Check whether the specified region ID is correct.
403 ParameterInvalid The specified AutoSnapshotPolicyId parameter is invalid. Invalid autoSnapshotPolicyId value.
403 ParameterInvalid The specified DiskIds are invalid. The specified disk ID is invalid. Check whether the specified disk ID is correct.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The account balance is insufficient. Add funds to your account and try again.
403 InvalidAccountStatus.SnapshotServiceUnavailable Snapshot service has not been opened yet. The operation is not supported because the snapshot service is not activated.
404 ParameterInvalid The specified automatic snapshot policy does not exist. The specified automatic snapshot policy is not found.
404 ParameterInvalid The specified automatic snapshot policy does not exist in the region. The specified automatic snapshot policy is not found in the region.
404 InvalidDiskId.NotFound The specified disk does not exist in the region. The specified disk is not found in the current region.

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