Template name
ACS-ECS-ScheduleToStartInstances: Start ECS instances on a schedule
Template description
Starts Elastic Compute Service (ECS) instances on a schedule. You can use this template to automatically start development or test environments at a specific time. Specify the region ID (regionId), a cron expression (cron) to define the schedule, and the target instances (targets) to start.
Template type
Automated
Owner
Alibaba Cloud
Input parameters
|
Parameter |
Description |
Type |
Required |
Default value |
Limit |
|
endDate |
The end time of the scheduled task. |
String |
Yes |
||
|
targets |
The target ECS instances to start. |
Json |
Yes |
||
|
regionId |
The region ID. |
String |
No |
{{ ACS::RegionId }} |
|
|
cron |
The CRON expression. |
String |
No |
0 0 12 ? * * |
|
|
timeZone |
The time zone. |
String |
No |
UTC |
|
|
rateControl |
The concurrency settings for task execution. |
Json |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
|
|
OOSAssumeRole |
The RAM role assumed by OOS. |
String |
No |
OOSServiceRole |
Output parameters
|
Parameter |
Description |
Type |
|
instanceIds |
List |
Required permissions
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:StartInstance"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
Details
For more information, see ACS-ECS-ScheduleToStartInstances.
Template content
FormatVersion: OOS-2019-06-01
Description:
en: 'Starts ECS instances on a schedule. Use this template to start instances at a specific time, such as automatically starting development or test environments. You must provide the region ID (regionId), a cron expression (cron), and the target instances (targets). The template then starts the specified instances according to the schedule.'
zh-cn: 'Starts ECS instances on a schedule. Use this template to start instances at a specific time, such as automatically starting development or test environments. You must provide the region ID (regionId), a cron expression (cron), and the target instances (targets). The template then starts the specified instances according to the schedule.'
name-en: ACS-ECS-ScheduleToStartInstances
name-zh-cn: Start ECS instances on a schedule
categories:
- time_trigger
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: Region ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
cron:
Description:
en: 'For more information, see https://www.alibabacloud.com/help/document_detail/169784.html'
zh-cn: 'For more information, see https://www.alibabacloud.com/help/document_detail/169784.html'
Label:
en: CronExpression
zh-cn: Cron expression
Type: String
AssociationProperty: Cron
Default: 0 0 12 ? * *
endDate:
Description:
en: 'Format: yyyy-MM-ddTHH:mm:ssZ.'
zh-cn: 'Format: yyyy-MM-ddTHH:mm:ssZ'
Label:
en: EndDate
zh-cn: End time of the trigger
Type: String
AssociationProperty: DateTime
AssociationPropertyMetadata:
Format: 'YYYY-MM-DDTHH:mm:ssZ'
timeZone:
Label:
en: TimeZone
zh-cn: Time zone
Type: String
AssociationProperty: TimeZone
Default: UTC
targets:
Type: Json
Label:
en: TargetInstance
zh-cn: Target instances
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
rateControl:
Label:
en: RateControl
zh-cn: Concurrency rate for task execution
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role assumed by OOS
Type: String
Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: timerTrigger
Action: ACS::TimerTrigger
Description:
en: Triggers a task on a schedule by specifying the trigger type and expression.
zh-cn: Triggers a task on a schedule by specifying the trigger type and expression.
Properties:
Type: cron
Expression: '{{ cron }}'
EndDate: '{{ endDate }}'
TimeZone: '{{ timeZone }}'
- Name: getInstance
Description:
en: Gets the ECS instances.
zh-cn: Gets the ECS instances.
Action: ACS::SelectTargets
Properties:
ResourceType: ALIYUN::ECS::Instance
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: Instances.Instance[].InstanceId
- Name: startInstance
Action: ACS::ECS::StartInstance
Description:
en: Starts the ECS instances.
zh-cn: Starts the instances.
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
Loop:
RateControl: '{{ rateControl }}'
Items: '{{ getInstance.instanceIds }}'
Outputs:
instanceIds:
Type: List
Value: '{{ getInstance.instanceIds }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- timeZone
- cron
- endDate
Label:
default:
zh-cn: Timer settings
en: Timer Trigger Configure
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select instances
en: Select ECS Instances
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced options
en: Control Options