Creating Scheduled Tasks for ECSs
Scenarios
ECS supports scheduled O&M. You can create scheduled tasks such as scheduled start, stop, restart, and deletion for one or more ECSs in a batch.
For example, if your services have regular peaks and lulls, you can start ECSs during peak hours and stop them during off-peak hours to reduce costs. Manually starting or stopping your ECSs is time-consuming and prone to errors. You can create scheduled tasks for automatic O&M on multiple ECSs, reducing labor and time costs.
This section describes how to create scheduled tasks for ECSs.
Notes and Constraints
- Scheduled tasks such as start, stop, and restart depend on Cloud Operations Center (COC). You need to enable and authorize COC.
For IAM users, permissions for COC operations need to be granted. For details, see Configuring Custom Policies for ECS Self-Service O&M.
- Each account can create a maximum of 200 scheduled tasks.
- Scheduled tasks only apply to ECSs in the same region.
- Only pay-per-use ECSs support scheduled deletion.
- Scheduled deletion is unavailable if you choose More > Create Scheduled Task above the ECS list.
Procedure
You can create scheduled start, stop, restart, and deletion tasks for one or more ECSs.
- Log in to the ECS console and access the ECS list page.
- Locate the target ECS and choose More > Create Scheduled Task > Schedule Start in the Operation column to create a scheduled start task for an individual ECS.
To create a scheduled start task for multiple ECSs, do as follows:
- In the ECS list, select the ECSs for which you want to create a scheduled task.
- Choose More > Create Scheduled Task > Schedule Start above the ECS list.
- (Optional) On the Enable COC and Grant Permissions page, read and agree to the service statement, and click Enable and Authorize.
This page is displayed if COC is not enabled and authorized.
- On the Create Task page, set parameters required for the scheduled task.
Table 1 Scheduled task parameters Parameter
Description
Task Name
Name of the scheduled task to be created.
The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).
Enterprise Project
Enterprise project that the scheduled task belongs to. It is used to manage resources and members in the project.
The default enterprise project is default.
Time Zone
Time zone of the scheduled task.
Scheduled Type
Scheduled type of the task. It can be one-time or periodic execution.
- One-time execution: A scheduled task is executed once at a specified time.
- Periodic execution: The scheduled task is executed periodically on a specific schedule.
Execute Time
Time when the scheduled task is executed.
- When One-time execution is selected for Scheduled Type, you specify the start time for the scheduled task.
- When Periodic execution is selected for Scheduled Type, you specify the execution period and time for the scheduled task.
- Simple: Specify the date and time for the scheduled task to be automatically executed every week.
- Cron: Specify the execution period and time for the scheduled task by setting the second, minute, hour, day, month, and week of a cron expression.
For details, see Using Cron Expressions.
Rule Expired
End time of a periodic scheduled task.
This parameter is displayed only when Periodic execution is selected for Scheduled Type.
Task Type
Type of the scheduled task.
It can be ECS startup, ECS shutdown, and ECS restart.
IAM Permission Agency
IAM agency assumed by COC to execute the scheduled task.
Target Instance
The instance where the scheduled task is to be executed. An instance is selected by default.
Batch Policy
The batch policy for executing a scheduled task, which can be any of the following:
- Automatic: The system automatically sets the batches for executing the scheduled task on target instances.
- Manual: You set the batches for executing the scheduled task on target instances.
- No Batch: The scheduled task is executed on all target instances at the same time.
The maximum number of target instances in each batch is 100.
- Click OK.
- Log in to the ECS console and access the ECS list page.
- Locate the target ECS and choose More > Create Scheduled Task > Schedule Stop in the Operation column to create a scheduled stop task for an individual ECS.
To create a scheduled stop task for multiple ECSs, do as follows:
- In the ECS list, select the ECSs for which you want to create a scheduled task.
- Choose More > Create Scheduled Task > Schedule Stop above the ECS list.
- (Optional) On the Enable COC and Grant Permissions page, read and agree to the service statement, and click Enable and Authorize.
This page is displayed if COC is not enabled and authorized.
- On the Create Task page, set parameters required for the scheduled task.
Table 2 Scheduled task parameters Parameter
Description
Task Name
Name of the scheduled task to be created.
The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).
Enterprise Project
Enterprise project that the scheduled task belongs to. It is used to manage resources and members in the project.
The default enterprise project is default.
Time Zone
Time zone of the scheduled task.
Scheduled Type
Scheduled type of the task. It can be one-time or periodic execution.
- One-time execution: A scheduled task is executed once at a specified time.
- Periodic execution: The scheduled task is executed periodically on a specific schedule.
Execute Time
Time when the scheduled task is executed.
- When One-time execution is selected for Scheduled Type, you specify the start time for the scheduled task.
- When Periodic execution is selected for Scheduled Type, you specify the execution period and time for the scheduled task.
- Simple: Specify the date and time for the scheduled task to be automatically executed every week.
- Cron: Specify the execution period and time for the scheduled task by setting the second, minute, hour, day, month, and week of a cron expression.
For details, see Using Cron Expressions.
Rule Expired
End time of a periodic scheduled task.
This parameter is displayed only when Periodic execution is selected for Scheduled Type.
Task Type
Type of the scheduled task.
It can be ECS startup, ECS shutdown, and ECS restart.
IAM Permission Agency
IAM agency assumed by COC to execute the scheduled task.
Target Instance
The instance where the scheduled task is to be executed. An instance is selected by default.
Batch Policy
The batch policy for executing a scheduled task, which can be any of the following:
- Automatic: The system automatically sets the batches for executing the scheduled task on target instances.
- Manual: You set the batches for executing the scheduled task on target instances.
- No Batch: The scheduled task is executed on all target instances at the same time.
The maximum number of target instances in each batch is 100.
- Click OK.
- Log in to the ECS console and access the ECS list page.
- Locate the target ECS and choose More > Create Scheduled Task > Schedule Restart in the Operation column to create a scheduled restart task for an individual ECS.
To create a scheduled restart task for multiple ECSs, do as follows:
- In the ECS list, select the ECSs for which you want to create a scheduled task.
- Choose More > Create Scheduled Task > Schedule Restart above the ECS list.
- Select a restart option.
- Restart: This is a regular start. It is used for routine maintenance to ensure data security and service running.
- Force restart: This is a forcible restart. It is used in emergencies because it takes effect quickly but has high risks.
Ensure that you have saved data on the ECSs before you force restart them, or the data may be lost.
- Click OK.
- (Optional) On the Enable COC and Grant Permissions page, read and agree to the service statement, and click Enable and Authorize.
This page is displayed if COC is not enabled and authorized.
- On the Create Task page, set parameters required for the scheduled task.
Table 3 Scheduled task parameters Parameter
Description
Task Name
Name of the scheduled task to be created.
The value can contain 3 to 100 characters, including letters, digits, hyphens (-), and underscores (_).
Enterprise Project
Enterprise project that the scheduled task belongs to. It is used to manage resources and members in the project.
The default enterprise project is default.
Time Zone
Time zone of the scheduled task.
Scheduled Type
Scheduled type of the task. It can be one-time or periodic execution.
- One-time execution: A scheduled task is executed once at a specified time.
- Periodic execution: The scheduled task is executed periodically on a specific schedule.
Execute Time
Time when the scheduled task is executed.
- When One-time execution is selected for Scheduled Type, you specify the start time for the scheduled task.
- When Periodic execution is selected for Scheduled Type, you specify the execution period and time for the scheduled task.
- Simple: Specify the date and time for the scheduled task to be automatically executed every week.
- Cron: Specify the execution period and time for the scheduled task by setting the second, minute, hour, day, month, and week of a cron expression.
For details, see Using Cron Expressions.
Rule Expired
End time of a periodic scheduled task.
This parameter is displayed only when Periodic execution is selected for Scheduled Type.
Task Type
Type of the scheduled task.
It can be ECS startup, ECS shutdown, and ECS restart.
IAM Permission Agency
IAM agency assumed by COC to execute the scheduled task.
Target Instance
The instance where the scheduled task is to be executed. An instance is selected by default.
Batch Policy
The batch policy for executing a scheduled task, which can be any of the following:
- Automatic: The system automatically sets the batches for executing the scheduled task on target instances.
- Manual: You set the batches for executing the scheduled task on target instances.
- No Batch: The scheduled task is executed on all target instances at the same time.
The maximum number of target instances in each batch is 100.
- Click OK.
- Log in to the ECS console and access the ECS list page.
- Locate the target ECS and choose More > Create Scheduled Task > Schedule Deletion in the Operation column to create a scheduled deletion task for an individual ECS.
- Only pay-per-use ECSs support scheduled deletion.
- Scheduled deletion is unavailable if you choose More > Create Scheduled Task above the ECS list.
- Select a deletion mode.
- Immediate: The ECS will be deleted upon the request is submitted. You can choose whether to delete associated resources.
- Scheduled: The ECS will be deleted at the specified time. You can choose whether to delete associated resources.
- (Optional) Specify a scheduled deletion time.
This parameter is available only when Deletion Mode is set to Scheduled. It specifies the time when the ECS and associated resources will be deleted as scheduled.
- Determine whether to delete associated resources.
Select the associated resources to be deleted together with the ECS as needed.
- Enter DELETE to confirm the deletion.
- Click OK.
Follow-up Procedure
On the Scheduled O&M page, you can enable, disable, modify, and delete scheduled tasks, and configure review and notification settings for scheduled tasks.
For details, see Scheduled Task Management.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot