A scheduled task executes a scaling rule at a specific time to automatically scale computing resources. This helps you adapt to predictable changes in demand while optimizing costs.
Configuration options
The following table describes the main configuration options for a scheduled task.
Parameter | Description |
Executed At | The time when the scheduled task runs.
Important The execution time must be within 90 days of the task's creation or modification date. |
Scaling Group | The target scaling group for the scheduled task. You must select an existing scaling group. For more information, see Overview of scaling groups. |
Scaling Method |
|
Simple Scaling Rule | This option appears only if Select Existing Scaling Rule is set to Select Existing Scaling Rule. Select an existing simple scaling rule. For more information, see Configure scaling rules or CreateScalingRule. |
Retry Interval (Seconds) | The interval during which Auto Scaling retries a failed scheduled task. Retries help prevent a single failed scaling activity from affecting the task's outcome. |
Recurrence | Defines how a scheduled task repeats. You can set a task to run once (no recurrence), or to repeat daily, weekly, or monthly. For more complex schedules, you can use a cron expression. For more information, see Cron expressions. Note When you modify a scheduled task, you cannot change its recurrence method to Not Set. |
Cron expressions
When you configure a scheduled task in the Auto Scaling console, you can use a cron expression to define its Recurrence.
A cron expression is a string that specifies a time and consists of fields separated by spaces. Scheduled tasks for Auto Scaling support 5-field cron expressions in the format X X X X X, where X is a placeholder for a field. In a cron expression, the fields represent minute, hour, day of the month, month, and day of the week in order. Each field can be a specific value or a special character that has a logical meaning.
When you configure a cron expression for a scheduled task, note the following:
Cron expressions use the UTC+0 time zone. You must convert your local time to UTC+0. For example, to run a task at 20:00 China Standard Time (UTC+8), subtract 8 hours and set the cron expression to
0 12 * * ?.A single cron-based scheduled task can run at most once every five minutes.
Ensure that the first execution time of the cron expression is earlier than the end time of the recurrence. Otherwise, a parameter error occurs.
Field | Required | Valid values | Special characters |
Minute | Yes | 0-59 | , - / * |
Hour | Yes | 0-23 | , - / * |
Day of month | Yes | 1-31 | , - / * ? L W |
Month | Yes | 1-12 | , - / * |
Day of week | Yes | 1-7, where 1 represents Sunday. | , - * ? / L # |
Special character | Description | Example |
| Includes all valid values in a field. | In the month field, |
| Separates items in a list of values. | In the minute field, |
| Specifies a range of values. | In the minute field, |
| Specifies increments. | In the minute field, |
| Indicates no specific value. This character is supported only in the day-of-month and day-of-week fields. Note When you specify a value for either the day-of-month or day-of-week field, you must use a | In the day-of-month field, |
| An abbreviation for "last". This character is supported only in the day-of-month and day-of-week fields. Note When using the |
|
| An abbreviation for "weekday". The task runs on the nearest weekday to the specified day. The | If you specify |
| Specifies the Nth day of the week in a month. This character is supported only in the day-of-week field. Valid values: 1 to 5. | In the day-of-week field, |
Cron expression (UTC+0) | Description (UTC+8) |
| Executes the task at 18:15 every day. |
| Executes the task at 17:15 every day. |
| Executes the task at 20:00 every day. |
| Executes the task at 18:00, 22:00, and 00:00 every day. |
| Executes the task at 18:15 on the 15th of every month. |
| Executes the task at 18:15 on the last day of every month. |
| Executes the task at 18:15 on the last Friday of every month. |
| Executes the task at 18:15 on the third Friday of every month. |
Configure a scheduled task
The following table lists resources for managing scheduled tasks.
Console documentation | Actions | API reference |
Create a scheduled task | ||
Modify a scheduled task | ||
Enable a scheduled task | N/A | |
Disable a scheduled task | N/A | |
Delete a scheduled task |
After you create a scheduled task, you can also call the DescribeScheduledTasks operation to view its details.