You can use public templates provided by Operation Orchestration Service (OOS) to automatically start and stop cloud desktops at a scheduled point in time. This helps you improve user experience and reduce costs when you use cloud desktops.
OOS is an automated O&M service that is provided by Alibaba Cloud. OOS can automatically manage and execute O&M tasks, including batch operations and scheduled tasks in the cloud. You can use templates to define O&M tasks, including task orders, input parameters, and output parameters. The O&M tasks are automatically executed based on what you defined in the templates.
- If you keep cloud desktops running for a long time, the cloud desktops may respond slowly. The scheduled stop of cloud desktops can improve user experience.
- Cloud desktops take a certain amount of time to start. A scheduled start ensures that cloud desktops are in the running state when you need to use them.
- For pay-as-you-go cloud desktops, you are not charged for the billable computing resources
such as vCPUs, memory, and GPUs during the period of time that the cloud desktops
are stopped. The scheduled start and stop of cloud desktops can meet your daily business
requirements and reduce costs.
Note During the period of time that the cloud desktops are stopped, you are not charged only for computing resources, but you are charged for other resources, such as storage resources.
Step 1: Create a RAM role and grant permissions to the role
When OOS executes a template, you need to obtain the permissions to use the APIs of other cloud services. You must create a RAM role for OOS and grant the role the permissions to manage cloud desktop resources. To create a RAM role and grant permissions to the role, perform the following operations:
- Log on to the RAM console.
- Create a RAM role.
- In the left-side navigation pane, choose .
- Click Create Role.
- In the Create Role panel, select Alibaba Cloud Service from the drop-down list of the trusted entities and click Next.
- Enter a role name and select Operation Orchestration Service from the drop-down list of the trusted services.
- Click OK.
- Grant permissions to the RAM role.
- On the Roles page, find the created RAM role and click Add Permissions. You can also click Add Permissions to RAM Role on the page that appears when you create the RAM role in Step 2.
- In the Add Permissions panel, select AliyunECDFullAccess Permissions from System Policy.
- Click OK.
- On the Roles page, find the created RAM role and click Add Permissions.
Step 2: Execute the template to start and stop cloud desktops
OOS provides public templates to start and stop cloud desktops at a scheduled point in time. You can execute the template to start and stop cloud desktops as scheduled. To execute a template, perform the following operations:
- Log on to the OOS console.
- In the left-side navigation pane, click Public Templates.
- In the Template Category section, click Scheduled Operation.
- Find the ACS-ECD-ScheduleToStartAndStopDesktops template and click Create Execution.
- On the wizard that appears, complete the configurations.
- Configure the basic information and click Next: Parameter Settings. By default, the settings in ACS-ECD-ScheduleToStartAndStopDesktops template are configured, excluding the start and stop time. You do not need to modify other configurations in this template.
- Set the start and stop time, and click Next: OK. The following table describes the parameters in the template.
Parameter Description regionId Specifies the region in which the cloud desktops reside. desktopIds Specifies the IDs of the cloud desktops to which you want to apply this template. You can enter up to 100 IDs. Each ID is recorded on a line. dailyStartTime Specifies the time when cloud desktops are started. dailyStopTime Specifies the time when cloud desktops are stopped. weekdays Specifies the execution period. You must use cron expressions. For example,
*indicates every day,
MONindicates only Monday, and
MON-FRIindicates Monday to Friday. For more information, see Configure cron expressions.
triggerEndDate Specifies the end time of the time trigger. This parameter specifies the time that the execution task is terminated. rateControl Specifies the rate control and the maximum number of errors.
- Rate Control: controls the execution rate of tasks in a loop. Concurrency-based Control
and Batch-based Control are available.
- Concurrency-based Control: specifies the concurrency rate. You can specify a numeric value or percentage to control the rate at which tasks are concurrently executed. For example, 1 indicates that one cloud desktop is executed at a time.
- Batch-based Control: manages batch rate arrays. You can divide an execution task into
multiple batches. After one batch is complete, the next batch of tasks is triggered.
The batch rate can be a numeric value or a percentage. For example,
[1,5%,10%]indicates that the first batch is one cloud desktop, the second batch is 5% of the total cloud desktops, the third batch is 10% of the total cloud desktops, and the fourth batch is the remaining number of cloud desktops.
- Error Threshold: specifies the maximum number of errors allowed before a task is stopped. You can set this parameter to a numeric value or a percentage. Default value: 0. This indicates that the task fails when one error occurs. If you set the value to 100%, the execution will continue regardless of how many errors occur.
For more information about the parameters, see Loop.
Permissions By default, the parameter is set to Specify RAM Role and Use Permissions Granted to This Role. You cannot modify this parameter. OOSAssumeRole Specifies the RAM role that you created in Step 1. To perform operations on cloud desktops, OOS must assume a RAM role that has the permissions to manage cloud desktop resources.Note When you execute this template, the cloud desktops first start and stop at the scheduled time. If the start time is later than the stop time, the cloud desktops start as scheduled on the first day, and start and stop as scheduled from the second day. For example, you create a task at 06:00:00 on the first day of a month to start and stop cloud desktops as scheduled. In the task, the start time is 14:00:00, the stop time is 08:00:00, and the task is executed on a daily basis. The OOS system only starts cloud desktops at 14:00:00 on the first day. From the second day of the month onwards, OOS stops cloud desktops at 08:00:00 and starts the cloud desktops at 14:00:00.
- Rate Control: controls the execution rate of tasks in a loop. Concurrency-based Control and Batch-based Control are available.
- Confirm the configurations and click Create.
- Configure the basic information and click Next: Parameter Settings.
View execution results
After you create an execution task, you can go to the Executions page in the OOS console and click the execution ID to view the details of the execution task, including the execution list, status, and logs.
When the start time and stop time are triggered, you can check the status of the cloud desktops on the Cloud Desktops page in the Elastic Desktop Service (EDS) console to confirm whether the scheduled start and stop feature is configured.