How to Reference Cross-Stack Resources in AWS CloudFormation?
A developer at a company writes an AWS CloudFormation template. The template refers to subnets that were created by a separate AWS CloudFormation template that the company's network team wrote. When the developer attempts to launch the stack for the first time, the launch fails. Which template coding mistakes could have caused this failure? (Choose two.)
Community Votes
100% of anonymous learners picked answer BD. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The question evaluates cross-stack referencing mechanics, where test-takers commonly miss that resources must be explicitly exported in Outputs before they can be imported elsewhere.
This scenario tests cross-stack resource sharing in AWS CloudFormation. Community consensus confirms that combining Fn::ImportValue with exported stack outputs is mandatory for successful deployments.
Candidates often incorrectly choose Option A, assuming the Ref intrinsic function works across stacks. Ref only resolves values within the same stack, making it incapable of bridging separate templates.
Community Discussion (5 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Cross-stack references require explicit configuration on both templates. The source stack must publish values in its Outputs section using Export names, while the consumer stack must call Fn::ImportValue to retrieve them. Omitting either step breaks the dependency chain and halts the stack launch.Why the Other Options Are Wrong
Option A fails because Ref is strictly scoped to the current stack context. Options C and E misapply Mappings, which store static key-value pairs and cannot dynamically link live infrastructure resources. CloudFormation simply does not support cross-stack lookups through Mappings or direct Ref calls.Community Comment Notes
Verified discussion threads consistently validate that Fn::ImportValue pairs exclusively with exported Outputs for cross-stack communication. Comment [1] accurately explains that skipping the export or import mechanism guarantees deployment failure. Comment [3] further emphasizes that Fn::ImportValue remains the standard intrinsic function for this exact architectural pattern.Official Reference
Exam Strategy
When reviewing cross-stack questions, always trace the data flow from export to import. Remember that Ref never crosses stack boundaries, allowing you to instantly discard similar distractors and focus on Fn::ImportValue paired with Outputs.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →