All Products
Search
Document Center

CloudOps Orchestration Service:Template outputs

Last Updated:Jun 16, 2026

A template can define its own outputs to surface important data after execution. In nested templates, the parent template can reference child template outputs through the ValueSelector parameter, enabling data flow between tasks across template boundaries.

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

Direct reference

You can reference task outputs directly 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 referenceable outputs for each task.

    image

    The task outputs show the available outputs for the task.

    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

You can also define custom output parameters for a template.

Syntax

A template output parameter value can reference any parameter available within the template, including task outputs, 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 }}"
    }
  }
}