{"id":6171,"date":"2019-07-20T00:16:18","date_gmt":"2019-07-20T00:16:18","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=6171"},"modified":"2020-03-30T02:38:59","modified_gmt":"2020-03-30T02:38:59","slug":"get-the-stack-name-of-a-nested-stack-in-cloudformation","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/get-the-stack-name-of-a-nested-stack-in-cloudformation\/","title":{"rendered":"Get the stack name of a nested stack in Cloudformation"},"content":{"rendered":"<p>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:<\/p>\n<pre lang=\"bash\">aws cloudformation describe-stack-resources --stack-name $PARENT_STACK | \\\n    jq -rc '.StackResources | .[] | select(.LogicalResourceId==\"NestedStack\") | .PhysicalResourceId'\n<\/pre>\n<p>That Arn is useless though if you want to get resources from the nested stack in the Cloudformation API &#8211; you need the name instead.<\/p>\n<p>What you can then do is list all your stacks, and filter by Arn:<\/p>\n<pre lang=\"bash>\naws cloudformation list-stacks --max-items 100000 \\\n  | jq -rc '.StackSummaries | .[] | select(.StackId==\" '$arn'\")=\"\" |=\"\" .stackname'=\"\" <=\"\" pre=\"\"><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Going from parent to child stacks in Cloudformation<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4,8],"tags":[71,114],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6171"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=6171"}],"version-history":[{"count":1,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6171\/revisions"}],"predecessor-version":[{"id":6451,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/6171\/revisions\/6451"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=6171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=6171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=6171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}