This topic describes how to call the CreateAutoSnapshotPolicy operation by using Alibaba Cloud CLI to create an automatic snapshot policy.

Background information

You can call the CreateAutoSnapshotPolicy operation to create an automatic snapshot policy. We recommend that you read the description of the operation before you call the operation. For more information, see CreateAutoSnapshotPolicy.

When you call an API operation through Alibaba Cloud CLI, make sure that request parameter values of different data types are in required formats. For more information, see Parameter format overview.

Request examples

Create a policy that the system automatically creates a snapshot at 00:00 and 12:00 every Monday and retains the automatic snapshots for 30 days.

aliyun ecs CreateAutoSnapshotPolicy --regionId cn-hangzhou --timePoints '["0", "12"]' --repeatWeekdays '["1"]' --retentionDays 30 --autoSnapshotPolicyName demo


        "RequestId": "267E4740-DCBE-4D88-A7F5-F04F921DEEBC",
        "AutoSnapshotPolicyId": "sp-bp1503ydxxrpoh8r****"