All Products
Search
Document Center

CloudOps Orchestration Service:ACS-ECS-BulkyCreateInstanceDiagnosticReport

Last Updated:Sep 20, 2024

Template name

ACS-ECS-BulkyCreateInstanceDiagnosticReport

Execute Now

Template description

Creates diagnostics reports for multiple Elastic Compute Service (ECS) instances at a time.

Template type

Automated

Owner

Alibaba Cloud

Input parameters

Parameter

Description

Type

Required

Default value

Limit

targets

The IDs of the ECS instances for which you want to create diagnostics reports.

Json

Yes

regionId

The region ID.

String

No

{{ ACS::RegionId }}

rateControl

The rate control settings.

Json

No

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

Output parameters

Parameter

Description

Type

metricResults

Json

Permission policy that is required to execute the template

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateDiagnosticReport",
                "ecs:DescribeDiagnosticReportAttributes",
                "ecs:DescribeInstances"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}

References

For more information, see ACS-ECS-BulkyCreateInstanceDiagnosticReport.yml at GitHub.

Template content

FormatVersion: OOS-2019-06-01
Description:
  name-en: ACS-ECS-BulkyCreateInstanceDiagnosticReport
  name-zh-cn: the description in Chinese
  en: Create diagnostic report for ECS instance in bulk
  zh-cn: the description in Chinese
Parameters:
  regionId:
    Type: String
    Label:
      en: RegionId
      zh-cn: the description in Chinese
    AssociationProperty: RegionId
    Default: '{{ ACS::RegionId }}'
  targets:
    Type: Json
    Label:
      en: Targets
      zh-cn: the description in Chinese
    AssociationProperty: Targets
    AssociationPropertyMetadata:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: regionId
  rateControl:
    Label:
      en: RateControl
      zh-cn: the description in Chinese
    Type: Json
    AssociationProperty: RateControl
    Default:
      Mode: Concurrency
      MaxErrors: 0
      Concurrency: 10
Tasks:
  - Name: getInstances
    Description:
      en: Views the ECS instances
      zh-cn: the description in Chinese
    Action: ACS::SelectTargets
    Properties:
      ResourceType: ALIYUN::ECS::Instance
      RegionId: '{{ regionId }}'
      Filters:
        - '{{ targets }}'
    Outputs:
      instanceIds:
        Type: List
        ValueSelector: Instances.Instance[].InstanceId
  - Name: createDiagnosticReports
    Action: ACS::ECS::CreateDiagnoseReport
    Description:
      en: Create diagnostic report for ECS instance
      zh-cn: the description in Chinese
    Properties:
      regionId: '{{ regionId }}'
      resourceId: '{{ ACS::TaskLoopItem }}'
      metricSetId: dms-instancedefault
    Loop:
      Items: '{{ getInstances.instanceIds }}'
      Outputs:
        metricResults:
          AggregateType: Fn::ListJoin
          AggregateField: metricResult
      RateControl: '{{ rateControl }}'
    Outputs:
      metricResult:
        Type: Json
        ValueSelector: .metricResults
Outputs:
  metricResults:
    Type: Json
    Value: '{{ createDiagnosticReports.metricResults }}'