Help Center/ Elastic Cloud Server/ User Guide/ Self-Service O&M/ Setting Scheduled Tasks for ECSs
Updated on 2024-10-31 GMT+08:00

Setting Scheduled Tasks for ECSs

Scenario

ECS supports scheduled O&M. You can schedule tasks such as starting and stopping multiple ECSs.

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 can be accident prone. You can set scheduled tasks for automatic O&M on multiple ECSs, reducing labor and time costs.

This section describes how to set scheduled tasks for ECSs.

Notes and Constraints

  • ECS scheduled O&M is dependent on Cloud Operations Center (COC). COC must be enabled and authorized.

    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 100 scheduled tasks.
  • Scheduled tasks only apply to ECSs in the same region.

Procedure

You can create scheduled start or stop tasks for one or more ECSs.

  1. Log in to the management console and go to the Elastic Cloud Server console.
  2. In the ECS list, locate the target ECS and choose More > Set Scheduled Tasks > Set Scheduled Start or Set Scheduled Stop in the Operation column.
  3. (Optional) On the Enable COC and Grant Permissions page, read the service statement, select the check box, and click Enable and Authorize.

    This page is displayed if COC is not enabled and authorized.

  4. 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.

    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.

    • If you choose Set Scheduled Start in step 2, the type is ECS startup.
    • If you choose Set Scheduled Stop in step 2, the type is ECS shutdown.

    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.

  5. Click Submit.
  1. Log in to the management console and go to the Elastic Cloud Server console.
  2. In the ECS list, select the ECSs for which you want to create a scheduled task.
  3. Above the ECS list, choose More > Set Scheduled Tasks > Set Scheduled Start or Set Scheduled Stop.
  4. (Optional) On the Enable COC and Grant Permissions page, read the service statement, select the check box, and click Enable and Authorize.

    This page is displayed if COC is not enabled and authorized.

  5. On the Create Task page, set parameters required for the scheduled task.
    Table 2 Parameters for configuring a scheduled task

    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 at a specified time.

    Execute Time

    Execution time of the scheduled task.

    • 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.

    Rule Expired

    End time of a periodic scheduled task.

    This parameter is only displayed when Periodic execution is selected for Scheduled Type.

    Task Type

    Type of the scheduled task.

    • If you choose Set Scheduled Start in step 3, the type is ECS startup.
    • If you choose Set Scheduled Stop in step 3, the type is ECS shutdown.

    IAM Permission Agency

    IAM agency assumed by COC to execute the scheduled task.

    Target Instance

    Target instances where the scheduled task is to be executed. Instances selected in step 2 are selected by default.

    Batch Policy

    Batch policy for executing a scheduled task. It 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.

  6. Click Submit.

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 Managing Scheduled Tasks.