All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-ScheduleToStartInstances

Last Updated:Dec 23, 2025

Template name

ACS-ECS-ScheduleToStartInstances: Start ECS instances on a schedule

Execute Now

Template description

Starts Elastic Compute Service (ECS) instances on a schedule. Use this template to start instances at a specific time. For example, you can automatically start development or test environments for a specified period. When you configure the template, you must provide the required parameters. The region ID (regionId) specifies the region of the instances. The cron expression (cron) defines the schedule of the task. The target instances (targets) specify the ECS instances to start. The template then starts the instances based on the schedule.

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

Target instance

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

Task execution concurrency ratio

Json

No

{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10}

OOSAssumeRole

The Resource Access Management (RAM) role that is assumed by CloudOps Orchestration Service (OOS).

String

No

OOSServiceRole

Output parameters

Parameter

Description

Type

instanceIds

List

Permission policy that is required to execute the template

{
    "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