Create a scheduled task

Last Updated: May 11, 2017

Description

This operation creates a scheduled task according to input parameters.

  • You can create up to 20 scheduled tasks.
  • When the trigger of a scheduled task fails because a scaling activity in a scaling group is in progress or the scaling group is disabled, the scheduled task is automatically retried within the LaunchExpirationTime; otherwise, the scheduled trigger task is abandoned.
  • If multiple tasks are scheduled at similar times to execute the rule of the same group, the earliest task triggers the scaling activity first, and other tasks make attempts to execute the rule within their Launch Expiration Time because a scaling group executes only one scaling activity at a time. If another scheduled task is still making triggering attempts within its Launch Expiration Time after the scaling activity is finished, the scaling rule is executed and the corresponding scaling activity is triggered.

Request parameters

Name Type Required? Description
Action String Yes Operation interface name, required parameter. Value: CreateScheduledTask.
RegionId String Yes ID of the region in which the scheduled task is located.
ScheduledAction String Yes Operations performed when the scheduled task is triggered. Fill in the unique identifier of the scaling rule.
LaunchTime String Yes Time point at which the scheduled task is triggered.
The date format follows the ISO8601 standard and uses UTC time. It is in the format of YYYY-MM-DDThh:mmZ.
If RecurrenceType is specified, the time point specified by this attribute is the default time point at which the circle is executed. If RecurrenceType is not specified, the task is executed once on the designated date and time.
A time point 90 days after creation or modification cannot be entered.
ScheduledTaskName String No Display name of the scheduled task, which must be 2-40 characters (English or Chinese) long. It must begin with a number, an upper/lower-case letter or a Chinese character and may contain numbers, “_”, “-“ or “.”.
The account name is unique in the same region.
If this parameter is not specified, the default value ScheduledScalingTaskId is used.
Description String No Description of the scheduled task, which is 2-200 characters (English or Chinese) long.
LaunchExpirationTime Integer No Time period within which the failed scheduled task is retried.
The default value is 600s.
Value range: [0, 21600]
RecurrenceType String No Type of the scheduled task to be repeated. Optional values:
- Daily: Recurrence interval by day for a scheduled task.
- Weekly: Recurrence interval by week for a scheduled task.
- Monthly: Recurrence interval by month for a scheduled task.
RecurrenceType, RecurrenceValue and RecurrenceEndTime must be specified.
RecurrenceValue String No Value of the scheduled task to be repeated.
- Daily: Only one value in the range [1,31] can be filled.
- Weekly: Multiple values can be filled. The values of Sunday to Saturday are 0 to 6 in sequence. Multiple values shall be separated by a comma “,”.
- Monthly: In the format of A-B. The value range of A and B is 1 to 31, and the B value must be greater than the A value.
RecurrenceType, RecurrenceValue and RecurrenceEndTime must be specified.
RecurrenceEndTime String No End time of the scheduled task to be repeated.
The date format follows the ISO8601 standard and uses UTC time. It is in the format of YYYY-MM-DDThh:mmZ.
A time point 90 days after creation or modification cannot be entered.
RecurrenceType, RecurrenceValue and RecurrenceEndTime must be specified.
TaskEnabled Bool No Whether to enable the scheduled task.
- When the parameter is set to true, the task is enabled.
- When the parameter is set to false, the task is disabled.
The default value is true.

Return parameters

Name Type Description
ScheduledTaskId String ID of the scheduled task, which is generated by the system and globally unique.

Error code

For errors common to all interfaces, refer to the Client Error Table or Server Error Table.

Error Error Code Description HTTP Status Code
The specified region does not exist. InvalidRegionId.NotFound The specified region does not exist. 404
The scheduled task name already exists. InvalidScheduledTaskName.Duplicate The specified value of parameter <parameter name> is duplicated. 400
The specified ScheduledAction and the specified scheduled task are not in the same region. ScheduledAction.RegionMismatch The specified scheduled task and the specified scheduled action are not in the same Region. 400
Your scheduled task quota is exceeded. QuotaExceeded.ScheduledTask Scheduled task quota exceeded. 400

Example

Request example
  1. http://ess.aliyuncs.com/?Action=CreateScheduledTask
  2. &RegionId=cn-qingdao
  3. &LaunchTime=2014-08-17T16:52Z
  4. &RecurrenceType=Daily
  5. &RecurrenceValue=1
  6. &RecurrenceEndTime=2014-08-17T16:55Z
  7. &ScheduledAction=ari:acs:ess:cn-qingdao:1344371:scalingRule/cCBpdYdQuBe2cUxOdu6piOk
  8. &<Public Request Parameters>
Return example

XML format:

  1. <CreateScheduledTaskResponse>
  2. <ScheduledTaskId>edRtShc57WGXdt8TlPbrjsnV</ScheduledTaskId>
  3. <RequestId>0F02D931-2B12-44D7-A0E9-39925C13D15E</RequestId>
  4. </CreateScheduledTaskResponse>

JSON format:

  1. "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  2. "ScheduledTaskId": "edRtShc57WGXdt8TlPbrjsnV"
Thank you! We've received your feedback.