All Products
Search
Document Center

Auto Scaling:Create a scheduled task

Last Updated:Feb 27, 2026

Call the CreateScheduledTask operation to create a scheduled task that triggers a scaling rule on a recurring schedule.

Prerequisites

Before you call this operation, make sure that the following requirements are met:

  • You have an Alibaba Cloud account and a valid AccessKey pair for API authentication. For more information about common request parameters such as AccessKeyId and Signature, see Common parameters.

  • You have created a scaling group. Record the scaling group ID, such as asg-bp18p2yfxow2dloq****.

  • You have created a scaling rule in the scaling group. Record the Alibaba Cloud Resource Identifier (ARN) of the scaling rule, such as ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp12tcnol686y1ik****.

Request parameters

The following table describes the key parameters for creating a scheduled task. For the full parameter list, see CreateScheduledTask.

ParameterTypeRequiredDescription
ActionStringYesThe API operation. Set the value to CreateScheduledTask.
RegionIdStringYesThe region ID of the scheduled task. Example: cn-qingdao.
LaunchTimeStringYesThe time at which the scheduled task is triggered. Specify the time in ISO 8601 format: YYYY-MM-DDThh:mmZ. The time must be in UTC.
ScheduledActionStringNoThe unique identifier (ARN) of the scaling rule to execute when the scheduled task is triggered. Example: ari:acs:ess:cn-hangzhou:140692647****:scalingrule/asr-bp12tcnol686y1ik****. You cannot specify both ScheduledAction and ScalingGroupId.
ScheduledTaskNameStringNoThe name of the scheduled task. Example: scheduled****.
ScalingGroupIdStringNoThe ID of the scaling group for which you want to create the scheduled task. If you specify this parameter, you must also specify at least one of MinValue, MaxValue, or DesiredCapacity. You cannot specify both ScalingGroupId and ScheduledAction.
RecurrenceTypeStringNoThe recurrence type. Valid values: Daily, Weekly, Monthly, Cron. Must be specified together with RecurrenceValue.
RecurrenceValueStringNoThe recurrence value. The valid value depends on RecurrenceType. Must be specified together with RecurrenceType.
RecurrenceEndTimeStringNoThe end time of the recurrence. Specify the time in ISO 8601 format: YYYY-MM-DDThh:mmZ. The time must be in UTC.
You must specify either ScheduledAction or ScalingGroupId in the request. The two parameters are mutually exclusive.
The RecurrenceType and RecurrenceValue parameters must be specified together. If you set one of these parameters, you must also set the other.

Sample request

The following example creates a scheduled task that triggers a scaling rule daily at 16:52 (UTC) and recurs until 2014-08-17T16:55Z.

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

A successful request returns the ScheduledTaskId of the created task and a RequestId for troubleshooting.

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****"
}

Related API operations

APIDescription
CreateScheduledTaskCreates a scheduled task.
DescribeScheduledTasksQueries scheduled tasks.
ModifyScheduledTaskModifies a scheduled task.
DeleteScheduledTaskDeletes a scheduled task.