All Products
Search
Document Center

Auto Scaling:Creates a scheduled task

Last Updated:Oct 23, 2023

This topic provides an example of how to call an API operation to create a scheduled task.

Description

In this example, the following parameters are used to create a scheduled task:

  • LaunchTime: the point in time at which the scheduled task is triggered. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mmZ format. The time must be in UTC.

  • RecurrenceType: the recurrence type of the scheduled task. If you use this parameter, you must also specify the RecurrenceValue parameter.

  • RecurrenceValue: the number of times that the scheduled task is repeatedly executed. If you use this parameter, you must also specify the RecurrenceType parameter.

  • RecurrenceEndTime: the end time of the recurrence period. Specify the time in the ISO 8601 standard in the YYYY-MM-DDThh:mmZ format. The time must be in UTC.

  • ScheduledAction: the scaling rule of the scheduled task. Specify the unique identifier of the scaling rule that you want to execute when the scaling task is triggered.

For more information about the parameters, see CreateScheduledTask.

Sample requests

http(s)://ess.aliyuncs.com/?Action=CreateScheduledTask
&RegionId=cn-qingdao
&ScheduledTaskName=scheduled****
&ScheduledAction=ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp12tcnol686y1ik****
&RecurrenceEndTime=2014-08-17T16:55Z
&LaunchTime=2014-08-17T16:52Z
&RecurrenceType=Daily
&RecurrenceValue=1
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&<Common request parameters>

Sample success responses

XML format

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

<CreateScheduledTaskResponse>
    <ScheduledTaskId>edRtShc57WGXdt8TlPbr****</ScheduledTaskId>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</CreateScheduledTaskResponse>

JSON format

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

{
  "ScheduledTaskId" : "edRtShc57WGXdt8TlPbr****",
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}