All Products
Search
Document Center

CloudOps Orchestration Service:Template outputs

Last Updated:Aug 15, 2025

In addition to outputs for each task, a template can have its own outputs to present important data that is obtained after the template is successfully executed. If a template is nested as a child template, the nesting task in the parent template can reference the outputs of the child template by defining its own task output parameters. The ValueSelector parameter filters the output parameter names of the child template to obtain their values. These values become the values of the nesting task's output parameters. This allows other tasks in the parent template to access the outputs of the child template by referencing the output parameters of the nesting task.

Template outputs (Outputs) are used to obtain key data, such as the IDs of created resources, after a template is executed. In a nested scenario, they act as a bridge for data transfer between the parent and child templates. The parent template can directly reference the outputs of the child template to create a field dependency between tasks. For example, a task in the parent template can obtain the ECS instance ID created by the child template and then pass this ID to a subsequent task to restart the instance.

Direct reference

You can directly reference the outputs of a task in the template outputs without pre-defining output parameters in the task.

  • Example of a single-task template:

    FormatVersion: OOS-2019-06-01
    Description: Execute a single API
    Tasks:
      - Name: ExecuteApi
        Action: ACS::ExecuteApi
        Description: Execute an API
        Properties:
          Service: ecs
          API: DescribeRegions
          Parameters:
            RegionId: cn-hangzhou
    Outputs:
      LocalName:
        Type: String
        Value: '{{ ExecuteApi.Regions.Region[]?.LocalName }}'
    FormatVersion: OOS-2019-06-01
    Description: Execute a single API
    Tasks:
      - Name: ExecuteApi
        Action: ACS::ExecuteApi
        Description: Execute an API
        Properties:
          Service: ecs
          API: DescribeRegions
          Parameters:
            RegionId: cn-hangzhou
    Outputs:
      LocalName:
        Type: String
        Value: '{{ ExecuteApi.Regions.Region[]?.LocalName }}'

    In the flow configuration interface, the system automatically lists the output items that can be referenced for each task.

    image

    The task outputs show the outputs that the task can provide.

    By default, task outputs are of the List type.

    image

    • You can directly select the corresponding output in the template outputs section.image

    • If there are multiple tasks, you can select outputs for each of them.image

  • Example of a multi-task template:

    FormatVersion: OOS-2019-06-01
    Description: Execute a single API
    Tasks:
      - Name: ExecuteApi
        Action: ACS::ExecuteApi
        Description: Execute an API
        Properties:
          Service: ecs
          API: DescribeRegions
          Parameters:
            RegionId: cn-hangzhou
        Outputs: {}
      - Action: ACS::ECS::RunCommand
        Name: RunCommand
        Description: ''
        Properties:
          regionId: '{{ ACS::RegionId }}'
          commandType: RunPowerShellScript
          commandContent: |-
            ##### This can be called when the script starts to run to print the current timestamp and PID.
            function job_start
            {
                $now = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
                "[{0}][{1}] job_start" -f $now,$pid
            }
    
            ##### If the return value is 0, the execution is considered successful. If the return value is not 0, the execution is considered failed.
            job_start
          contentEncoding: PlainText
          workingDir: C:\\Windows\\System32
          timeout: 600
          enableParameter: false
          parameters: {}
          username: ''
          windowsPasswordName: ''
          maxRetryInterval: 300
    Outputs:
      CommandOutput:
        Type: String
        Value: '{{ RunCommand.invocationOutput }}'
    
    {
      "FormatVersion": "OOS-2019-06-01",
      "Description": "Execute a single API",
      "Tasks": [
        {
          "Name": "ExecuteApi",
          "Action": "ACS::ExecuteApi",
          "Description": "Execute an API",
          "Properties": {
            "Service": "ecs",
            "API": "DescribeRegions",
            "Parameters": {
              "RegionId": "cn-hangzhou"
            }
          },
          "Outputs": {}
        },
        {
          "Action": "ACS::ECS::RunCommand",
          "Name": "RunCommand",
          "Description": "",
          "Properties": {
            "regionId": "{{ ACS::RegionId }}",
            "commandType": "RunPowerShellScript",
            "commandContent": "##### This can be called when the script starts to run to print the current timestamp and PID.\nfunction job_start\n{\n    $now = Get-Date -Format \"yyyy-MM-dd HH:mm:ss\"\n    \"[{0}][{1}] job_start\" -f $now,$pid\n}\n\n##### If the return value is 0, the execution is considered successful. If the return value is not 0, the execution is considered failed.\njob_start",
            "contentEncoding": "PlainText",
            "workingDir": "C:\\\\Windows\\\\System32",
            "timeout": 600,
            "enableParameter": false,
            "parameters": {},
            "username": "",
            "windowsPasswordName": "",
            "maxRetryInterval": 300
          }
        }
      ],
      "Outputs": {
        "CommandOutput": {
          "Type": "String",
          "Value": "{{ RunCommand.invocationOutput }}"
        }
      }
    }

Defined reference

The following sections describe how to use custom parameters.

Syntax

The value of a template's output parameter can be the value of any parameter that can be referenced within the template. These include the outputs of other tasks, pseudo parameters, and parameters defined in the Parameters section.

Single output:

Outputs:
  OutputParameterName: # Required. The parameter name. The name can contain letters, digits, underscores (_), and hyphens (-). The name can be up to 200 characters in length.
    Type: String # Optional. The primitive data type supported by YAML or JSON, such as String, Number, Boolean, List (Array), or Object. The default value is String.
    Value: "{{ TaskName.OutputParameterName }}" # Required. The parameter value. This is usually the output of a task.
{
  "Outputs": {
    "OutputParameterName": {
      "Type": "String",
      "Value": "{{ TaskName.OutputParameterName }}"
    }
  }
}

Multiple outputs:

Outputs:
  OutputParameterName1: 
    Type: String # Optional. The primitive data type supported by YAML or JSON, such as String, Number, Boolean, List (Array), or Object. The default value is String.
    Value: "{{ TaskName1.OutputParameterName }}" # Required. The parameter value. This is usually the output of a task.
  OutputParameterName2: # Required. The parameter name. The name can contain letters, digits, underscores (_), and hyphens (-). The name can be up to 200 characters in length.
    Type: String # Optional. The primitive data type supported by YAML or JSON, such as String, Number, Boolean, List (Array), or Object. The default value is String.
    Value: "{{ TaskName2.OutputParameterName }}" # Required. The parameter value. This is usually the output of a task.
  OutputParameterName3: # Required. The parameter name. The name can contain letters, digits, underscores (_), and hyphens (-). The name can be up to 200 characters in length.
    Type: String # Optional. The primitive data type supported by YAML or JSON, such as String, Number, Boolean, List (Array), or Object. The default value is String.
    Value: "{{ TaskName3.OutputParameterName }}" # Required. The parameter value. This is usually the output of a task.
{
  "Outputs": {
    "OutputParameterName1": {
      "Type": "String",
      "Value": "{{ TaskName1.OutputParameterName }}"
    },
    "OutputParameterName2": {
      "Type": "String",
      "Value": "{{ TaskName2.OutputParameterName }}"
    },
    "OutputParameterName3": {
      "Type": "String",
      "Value": "{{ TaskName3.OutputParameterName }}"
    }
  }
}