Get the stack name of a nested stack in Cloudformation

One issue you sometimes hit with Cloudformation is that the value exported by a resource is not in the form you need to invoke a dependent resource. For instance, you can look up a nested stack ARN like so:

aws cloudformation describe-stack-resources --stack-name $PARENT_STACK | \
    jq -rc '.StackResources | .[] | select(.LogicalResourceId=="NestedStack") | .PhysicalResourceId'

That Arn is useless though if you want to get resources from the nested stack in the Cloudformation API – you need the name instead.

What you can then do is list all your stacks, and filter by Arn:


	

Leave a Reply

Your email address will not be published. Required fields are marked *