CreateAutoSnapshotPolicy

Last Updated: Mar 20, 2018

Description

Creates an automatic snapshot policy. You can apply the automatic snapshot policies to disk (ApplyAutoSnapshotPolicy). Alternatively, you can modify automatic snapshot policies (ModifyAutoSnapshotPolicyEx) afterwards. When you call this interface, consider the following:

  • You can create up to 100 automatic snapshot policies in each region.

  • If a disk contains a large volume of data and the snapshot creation time exceeds an interval of the two scheduled automatic snapshot time points, no snapshot is taken at the second time point.

    Sample: Jimmy sets the automatic snapshot time points at 09:00, 10:00, 11:00, and 12:00. The first automatic snapshot starts at 09:00 and is finished at 10:20, and the actual time consumed is 80 minutes. We will skip the snapshot task scheduled at 10:00 and create another automatic snapshot for Jimmy at 11:00.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: CreateAutoSnapshotPolicy.
RegionId String Yes The region of the automatic snapshot policy. For more information, see Regions and zones, or call DescribeRegions to obtain the latest region list.
TimePoints String Yes The automatic snapshot creation time, and the unit of measurement is hour. Value range: [0, 23], which represents from 00:00 to 24:00, for example 1 indicates 01:00.
When you want to schedule multiple automatic snapshot tasks for a disk in a day, you can set the TimePoints to an array.
  • A maximum of 24 time points can be selected.
  • The format is an JSON array of ["0", "1", … "23"] and the time points are separated by commas (,).
RepeatWeekdays String Yes The automatic snapshot repetition dates. The unit of measurement is day and the repeating cycle is a week. Value range: [1, 7], which represents from Monday to Sunday, for example 1 indicates Monday.
When you want to schedule multiple automatic snapshot tasks for a disk in a week, you can set the RepeatWeekdays to an array.
  • A maximum of seven time points can be selected.
  • The format is an JSON array of ["1", "2", … "7"] and the time points are separated by commas (,).
RetentionDays integer Yes The snapshot retention time, and the unit of measurement is day. Optional values:
  • -1: The automatic snapshots are retained permanently.
  • [1, 65536]: The number of days retained.
Default value: -1.
AutoSnapshotPolicyName String No The name of the automatic snapshot policy.
  • It can consist of [2, 128] English or Chinese characters.
  • Must begin with an uppercase or lowercase letter or a Chinese character.
  • Can contain numbers, periods (.), underscores (_), and hyphens (-).
  • Cannot start with http:// or https://.
Default value: null.
ClientToken String No To guarantee the idempotence of the request. The value is generated by a client. It must be unique among all requests and contains a maximum of 64 ASCII characters.
For more information, see How to ensure idempotence.

Response parameters

Name Type Description
AutoSnapshotPolicyId String The automatic snapshot policy ID.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=CreateAutoSnapshotPolicy
  2. &RegionId=cn-hangzhou
  3. &TimePoints=["0", "11", "21"]
  4. &RepeatWeekdays=["1", "2", "4", "7"]
  5. &RetentionDays=30
  6. &<Common Request Parameters>

Response example

XML format

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

JSON format

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

Error codes

Error code Error message HTTP status code Meaning
AutoSnapshotPolicy.QuotaExceed The maximum number of automatic snapshot policy has been reached. 403 The maximum number of snapshots you can create for a disk is 64.
ParameterInvalid The specified RegionId parameter is invalid. 404 The specified RegionId parameter is invalid.
ParameterInvalid The specified RepeatWeekDays parameter is invalid. 404 The specified RepeatWeekDays parameter is invalid.
ParameterInvalid The specified RetentionDays parameter is invalid. 404 The specified RetentionDays parameter is invalid.
ParameterInvalid The specified TimePoints parameter is invalid. 404 The specified TimePoints parameter is invalid.
Thank you! We've received your feedback.