All Products
Search
Document Center

Resource Orchestration Service:Fn::GetStackOutput

Last Updated:Jun 02, 2026

The intrinsic function Fn::GetStackOutput queries the output of a stack.

Declaration

  • JSON

    {
      "Fn::GetStackOutput": [
        Stack,
        OutputName,
        RegionId
      ]
    }
  • YAML

    • Syntax for the full function name:

      Fn::GetStackOutput: Stack, OutputName, RegionId
    • Syntax for the short form:

      !GetStackOutput [Stack, OutputName, RegionId]

Parameters

  • Stack: Required. The name or ID of the stack. The value must be of the String type.

  • OutputName: Required. The name of an output defined in the stack's Outputs section. The value must be of the String type.

  • RegionId: Optional. The region ID of the referenced stack. The value must be of the String type. Defaults to the region of the stack where the function is called.

Return value

The value of the output identified by OutputName. The type matches the output value's type.

An empty string is returned in the following cases:

  • A required parameter is empty.

  • The stack does not exist or has been deleted.

  • The stack is running or fails to be deleted.

  • The specified output does not exist in the stack.

Limits

  • Only one-way references are supported. Stack A can reference stack B's output, and stack B can reference stack C's output, but stack B cannot reference stack A's output (which creates a circular reference), and a stack cannot reference its own output (for example, A→A is not supported).

  • The maximum reference depth is 3. A chain of A→B→C is supported, but A→B→C→D is not.

Note

A, B, C, D, E represents the name of an output in a stack. The maximum reference depth represents the maximum reference depth of OutputName in the Fn::GetStackOutput function.

Sample templates

The following example shows three stacks — stack_a, stack_b, and stack_c — where each stack's output depends on the previous stack's output. The final output of stack_c resolves to stack_depth_3, the value originally defined in stack_a.

  • stack_a

    ROSTemplateFormatVersion: '2015-09-01'
    Outputs:
    	OutputValueA:
      	Value: 'stack_depth_3'
  • stack_b

    ROSTemplateFormatVersion: '2015-09-01'
    Outputs:
    	OutputValueB:
      	Value: 
        	Fn::GetStackOutPut:
        	- stack_a_id
        	- OutputValueA
  • stack_c

    ROSTemplateFormatVersion: '2015-09-01'
    Outputs:
    	OutputValueC:
      	Value: 
        	Fn::GetStackOutPut:
        	- stack_b_id
        	- OutputValueB

Examples

!GetStackOutput [4a6c9851-3b0f-4f5f-b4ca-a14bf691****, InstanceId]