Template name
ACS-ECD-ScheduleToStartAndStopDesktops
Template description
Starts and stops multiple cloud desktops at the scheduled time.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
Parameter | Description | Data type | Required | Default value | Limit |
dailyStartTime | The time when the instances are started each day. | String | Yes | ||
dailyStopTime | The time when the instances are stopped each day. | String | Yes | ||
regionId | The region ID. | String | No | {{ ACS::RegionId }} | |
desktopIds | The IDs of the cloud desktops. | List | No | [] | |
weekdays | The cycle of the scheduled task. | String | No | MON-FRI | |
triggerEndDate | The end time of the scheduled task. | String | No | 2099-12-01T00:00:00Z | |
rateControl | The rate control settings. | Json | No | {'Mode': 'Concurrency', 'MaxErrors': '100%', 'Concurrency': 10} | |
OOSAssumeRole | The RAM role that is assumed by CloudOps Orchestration Service (OOS). | String | No | OOSServiceRole |
Output parameters
N/A.
Permission policy that is required to execute the template
{
"Version": "1",
"Statement": [
{
"Action": [
"ecd:DescribeDesktops",
"ecd:StartDesktops",
"ecd:StopDesktops"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
References
ACS-ECD-ScheduleToStartAndStopDesktops
Template content
FormatVersion: OOS-2019-06-01
Description:
en: Schedule to start and stop desktops
name-en: ACS-ECD-ScheduleToStartAndStopDesktops
categories:
- time_trigger
Parameters:
regionId:
Label:
en: RegionId
Type: String
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
desktopIds:
Label:
en: DesktopIds
Type: List
Default: []
dailyStartTime:
Label:
en: DailyStartTime
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: HH:mm:ssZ
dailyStopTime:
Label:
en: DailyStopTime
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: HH:mm:ssZ
weekdays:
Description:
en: '* indicates daily, MON indicates Monday only, MON-FRI indicates Monday to Friday. Refer them here: https://help.aliyun.com/document_detail/169784.html'
Label:
en: Weekdays
Type: String
Default: MON-FRI
triggerEndDate:
Label:
en: TriggerEndDate
Description:
en: 'Format: yyyy-MM-ddTHH:mm:ssZ.'
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: YYYY-MM-DDTHH:mm:ssZ
Default: '2099-12-01T00:00:00Z'
rateControl:
Label:
en: RateControl
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 100%
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task as scheduled by specifying Cron expression
Properties:
Type: cron
EndDate: '{{ triggerEndDate }}'
Expression:
Fn::Join:
- ' '
- - '0'
- Fn::Select:
- 1
- Fn::Split:
- ':'
- '{{ dailyStartTime }}'
- Fn::Select:
- 0
- Fn::Split:
- ':'
- '{{ dailyStartTime }}'
- '?'
- '*'
- '{{ weekdays }}'
- Name: getDesktop
Description:
en: Query the ECD desktops
Action: ACS::ExecuteApi
Properties:
Service: ECD
API: DescribeDesktops
Parameters:
RegionId: '{{ regionId }}'
DesktopId: '{{ desktopIds }}'
Outputs:
desktopIds:
Type: List
ValueSelector: Desktops[].DesktopId
- Name: startDesktops
Action: ACS::ECD::StartDesktop
Description:
en: Start the desktops
Properties:
regionId: '{{ regionId }}'
desktopId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getDesktop.desktopIds }}'
- Name: sleepToSpecifiedTime
Description:
en: Sleep to desktop stop time
Action: ACS::Sleep
Properties:
Duration:
'Fn::DurationBetween':
- '{{ dailyStartTime }}'
- '{{ dailyStopTime }}'
- Name: stopDesktop
Action: ACS::ECD::StopDesktop
Description:
en: Stop the desktops
Properties:
regionId: '{{ regionId }}'
desktopId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getDesktop.desktopIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- dailyStartTime
- dailyStopTime
- weekdays
- triggerEndDate
Label:
default:
en: Configure Parameters
- Parameters:
- regionId
- desktopIds
Label:
default:
en: Select ECD Desktops
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
en: Control Options