All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-ScheduleToCollectInventoryData

Last Updated:Dec 23, 2025

Template name

ACS-ECS-ScheduleToCollectInventoryData collects inventory data periodically.

Execute Now

Template description

Collects inventory data as scheduled.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

linuxOptions

The options that are specified to collect inventory data in a Linux Elastic Compute Service (ECS) instance.

String

Yes

windowsOptions

The options that are specified to collect inventory data in a Windows ECS instance.

String

Yes

targets

Target instance

Json

Yes

regionId

The region ID of the ECS instance.

String

No

{{ ACS::RegionId }}

cron

The CRON expression.

String

No

0 15/30 * ? * *

rateControl

Task execution concurrency

Json

No

{'Mode': 'Concurrency', 'MaxErrors': '100%', 'Concurrency': 20}

OOSAssumeRole

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

String

No

OOSServiceRole

Output parameters

None

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:DescribeInstances",
                "ecs:DescribeInvocationResults",
                "ecs:DescribeInvocations",
                "ecs:RunCommand"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "oos:GetApplicationGroup"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

Details

Details of ACS-ECS-ScheduleToCollectInventoryData

Template content

FormatVersion: OOS-2019-06-01
Description:
  en: Collect inventory data periodically
  zh-cn: Collect inventory data periodically
  name-en: ACS-ECS-ScheduleToCollectInventoryData
  name-zh-cn: Collect inventory data periodically
  categories:
    - time_trigger
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: The region ID of the instance
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  linuxOptions:
    Label:
      en: LinuxOptions
      zh-cn: The option string for collecting inventory from Linux instances
    Type: String
  windowsOptions:
    Label:
      en: WindowsOptions
      zh-cn: The option string for collecting inventory from Windows instances
    Type: String
  cron:
    Description:
      en: 'Refer them here: 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 15/30 * ? * *
  targets:
    Type: Json
    Label:
      en: TargetInstance
      zh-cn: Target instance
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: The concurrency rate for task execution
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 100%
      Concurrency: 20
  OOSAssumeRole:
    Label:
      en: OOSAssumeRole
      zh-cn: The RAM role to be assumed by OOS
    Type: String
    Default: OOSServiceRole
RamRole: '{{ OOSAssumeRole }}'
Tasks:
  - Name: timerTrigger
    Action: 'ACS::TimerTrigger'
    Description:
      en: Triggers a task as scheduled by specifying Cron expression
      zh-cn: Triggers a task as scheduled by specifying a cron expression
    Properties:
      Type: cron
      Expression: '{{ cron }}'
      EndDate: '2099-01-01T00:00:00Z'
      TimeZone: UTC
  - Name: getInstance
    Description:
      en: Views the ECS instances
      zh-cn: Retrieves the ECS instances
    Action: 'ACS::SelectTargets'
    Properties:
      ResourceType: 'ALIYUN::ECS::Instance'
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: 'Instances.Instance[].InstanceId'
  - Name: putInventory
    Action: 'ACS::ECS::PutInventory'
    Description:
      en: Collect inventory data
      zh-cn: Collects inventory data
    Properties:
      regionId: '{{ regionId }}'
      instanceId: '{{ ACS::TaskLoopItem }}'
      linuxOptions: '{{ linuxOptions }}'
      windowsOptions: '{{ windowsOptions }}'
    Loop:
      RateControl: '{{ rateControl }}'
      Items: '{{ getInstance.instanceIds }}'
Metadata:
  ALIYUN::OOS::Interface:
    ParameterGroups:
      - Parameters:
          - cron
        Label:
          default:
            zh-cn: Timer Settings
            en: Timer Trigger Configure
      - Parameters:
          - linuxOptions
          - windowsOptions
        Label:
          default:
            zh-cn: Parameter Settings
            en: Configure Parameters
      - Parameters:
          - regionId
          - targets
        Label:
          default:
            zh-cn: Instance Selection
            en: Select Instances
      - Parameters:
          - rateControl
          - OOSAssumeRole
        Label:
          default:
            zh-cn: Advanced Options
            en: Control Options