You can call this operation to modify an automatic snapshot policy. After you modify an automatic snapshot policy, the new policy takes effect immediately on the disks that have applied the policy.

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

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

autoSnapshotPolicyId String Yes sp-bp12m37ccmxvbmi5****

The ID of the automatic snapshot policy to be modified. You can call the DescribeAutoSnapshotPolicyEx operation to view the available automatic snapshot policies.

regionId String Yes cn-hangzhou

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

autoSnapshotPolicyName String No SPTestName

The name of the automatic snapshot policy. If you do not want to change the name, you can leave the parameter empty.

timePoints String No ["0", "1"]

The point in time at which automatic snapshots are created. Unit: hour. Valid values: 0 to 23, representing 24 points in time that range from 00:00 to 23:00. For example, 1 indicates 01:00. If you want to create multiple automatic snapshots a day, you can specify multiple points in time.

  • You can specify up to 24 points in time.
  • You must specify the parameter in a JSON-formatted array: ["0", "1", ... "23"]. Separate multiple values with commas (,).
repeatWeekdays String No ["1", "7"]

The days when the automatic snapshot policy recurs within a week. Unit: days. Valid values: 1 to 7, corresponding to the days of a week, where 1 indicates Monday. To schedule multiple automatic snapshot tasks for a disk in a week, you can set the repeatWeekdays parameter to an array.

  • You can specify up to seven days over a one-week period.
  • You must specify the parameter in a JSON-formatted array: ["1", "2", ... "7"]. Separate multiple values with commas (,).
retentionDays Integer No 30

The retention period of an automatic snapshot. Unit: days. Default value: -1. Valid values:

  • -1: The automatic snapshot is retained permanently.
  • 1-65536: The automatic snapshot is retained for the specified number of days.

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=ModifyAutoSnapshotPolicyEx
&autoSnapshotPolicyId=sp-bp12m37ccmxvbmi5****
&regionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

HttpCode 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 the region. Check whether the policy is correct.
403 ParameterInvalid The specified RegionId parameter is invalid. The error message returned because the specified regionId parameter is invalid.
403 ParameterInvalid The specified RepeatWeekDays parameter is invalid. The error message returned because the specified repeatWeekDays parameter is invalid.
403 ParameterInvalid The specified TimePoints parameter is invalid. The error message returned because the specified timePoints parameter is invalid.
403 ParameterInvalid The specified AutoSnapshotPolicyId is invalid. The error message returned because the specified autoSnapshotPolicyId parameter is invalid.
403 ParameterInvalid The specified RetentionDays parameter is invalid. The error message returned because the specified retentionDays parameter is invalid.

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