Creates an automatic snapshot policy. After you create an automatic snapshot policy, you can call ApplyAutoSnapshotPolicy to apply it to any disks. You can call ModifyAutoSnapshotPolicyEx to modify a created automatic snapshot policy as required.

Description

When you call this operation, note that:

  • You can create up to 100 automatic snapshot policies in each region.
  • If a disk contains a large volume of data, the amount of time it takes to create a snapshot can take longer than the interval between scheduled automatic snapshots. In these cases, the second scheduled snapshot will not be taken. Assume that you set the automatic snapshot time points at 09:00, 10:00, 11:00, and 12:00. If the first automatic snapshot taken at 09:00 took 80 minutes to complete and ended at 10:20, the task scheduled for 10:00 will be skipped. A snapshot for 11:00 will be taken as scheduled.

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

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

repeatWeekdays String Yes "1"

The repeat date for the automatic snapshot. This parameter specifies on which day of the week that the automatic snapshot is created. 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 a maximum of seven dates.
  • You must specify the parameter in a JSON-formatted array: ["1", "2", … "7"]. Separate multiple values with commas (,).
retentionDays Integer Yes 30

The retention period of the automatic snapshot. Unit: day. Valid values:

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

Default value: -1.

timePoints String Yes ["0", "1", … "23"]

The point in time at which the automatic snapshot is created. Unit: hour. Valid values: 0 to 23, corresponding to the 24 hours within the range of 00:00 to 23:00. For example, 1 indicates 01:00. To schedule multiple automatic snapshot tasks for a disk in a day, you can set the TimePoints parameter to an array. You can specify a maximum of 24 points in time.

Action String No CreateAutoSnapshotPolicy

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

autoSnapshotPolicyName String No FinanceJoshua

The name of the automatic snapshot policy.

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

Default value: null.

Response parameters

Name Type Example Description
AutoSnapshotPolicyId String p-233e6ylv0

The ID of the automatic snapshot policy.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=CreateAutoSnapshotPolicy
&regionId=cn-hangzhou
&repeatWeekdays=["1"] 
&retentionDays=30 
&timePoints=["0", "19"] 
&autoSnapshotPolicyName=FinanceJoshua 
&<Common request parameters>

Successful response examples

XML format

<CreateAutoSnapshotPolicyResponse>
  <RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
  <AutoSnapshotPolicyId>p-233e6ylv0</AutoSnapshotPolicyId>
</CreateAutoSnapshotPolicyResponse>

JSON format

{
	"RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE",
	"AutoSnapshotPolicyId":"p-233e6ylv0"
}

Error codes

HTTP status code Error code Error message Description
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 RepeatWeekDays parameter is invalid. The error message returned when the specified value of the RepeatWeekDays parameter is invalid.
403 ParameterInvalid The specified TimePoints parameter is invalid. The error message returned when the specified value of the TimePoints parameter is invalid.
403 ParameterInvalid The specified RetentionDays parameter is invalid. The error message returned when the specified value of the RetentionDays parameter is invalid.
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