Cloudformation:Outputs and variables

Learn
1 min readJul 15, 2022

--

Let us walk through a cloudformation stack erroring out on you.

Invalid target group ARN:TG1

Failing stack template yml
First step now is to open up the template yml for the stack that failed. You find the portion in the yml that references the target group.

ImportValue variable
You see an import value tag with roughly syntax as below.

TargetGroupId: !ImportValue dev-01-create-target-group-arn

That did not read TG1. So, now you have to hunt dev-01-create-target-group-arn. ImportValue is importing a value that was ouput from another stack.

Output variable from another stack
From Cloudformation UI, navigate to the previous stack’s Outputs section till you find the matching output variable name “dev-01-create-target-group-arn” .

Now, you look at the template yaml of the first stack to see where the output variable came from. Would look like so per AWS documentation.

Outputs:
Logical ID:
Description: Information about the value
Value: Value to return
Export:
Name: Name of resource to export

Now, you figure out how to fix the first stack to produce the right output variable so that the second stack would stop failing.

--

--

Learn
Learn

Written by Learn

On a continuing learning journey..

No responses yet