Skip to main content

AWS DVA-C02 Drill: CloudFormation Cross-Stack References - Proper Import and Export

Jeff Taakey
Author
Jeff Taakey
21+ Year Enterprise Architect | AWS SAA/SAP & Multi-Cloud Expert.

Jeff’s Note
#

Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.

For AWS DVA-C02 candidates, the confusion often lies in how to properly reference resources created in another CloudFormation stack. In production, this is about knowing exactly when to use Export/ImportValue vs. Ref, and ensuring resource sharing is configured so stacks don’t fail to launch due to unresolved references. Let’s drill down.

The Certification Drill (Simulated Question)
#

Scenario
#

At NexGen Apps, the development team is building a new CloudFormation template to deploy an application stack. The networking team previously deployed a separate CloudFormation stack that created and manages VPC subnets. The developer tries to launch the application stack referencing these subnets from the network stack but the deployment fails on the first attempt.

The Requirement
#

Identify which template coding mistakes could have caused the failure to launch the stack. (Choose two.)

The Options
#

  • A) The developer’s template does not use the Ref intrinsic function to refer to the subnets.
  • B) The developer’s template does not use the ImportValue intrinsic function to refer to the subnets.
  • C) The Mappings section of the developer’s template does not refer to the subnets.
  • D) The network team’s template does not export the subnets in the Outputs section.
  • E) The network team’s template does not export the subnets in the Mappings section.

Google adsense
#

leave a comment:

Correct Answer
#

B and D

Quick Insight: The Developer Imperative
#

  • CloudFormation cross-stack references require the network stack to explicitly export resources via the Outputs section using the Export key, and the dependent stack must use the ImportValue intrinsic function to pull those exported values.
  • Using Ref alone cannot reference resources from a separate stack. Mappings are unrelated to resource referencing. Without export declarations in the producing stack, imports will fail.

Content Locked: The Expert Analysis
#

You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?


The Expert’s Analysis
#

Correct Answer
#

B) The developer’s template does not use the ImportValue intrinsic function to refer to the subnets.
D) The network team’s template does not export the subnets in the Outputs section.

The Winning Logic
#

In AWS CloudFormation, cross-stack references must be enabled through explicit export/import mechanisms—a value exported from one stack is consumed by another using the ImportValue intrinsic function. This means:

  • The producer stack (network stack) needs to declare the subnet IDs as Outputs with the Export field to make them accessible externally.
  • The consumer stack (developer’s app stack) must use ImportValue referencing the export name to retrieve the subnet IDs at deployment time.

Using just Ref will only work within the same stack or nested stacks and will not resolve values across independent stacks.

Mappings have nothing to do with dynamic cross-stack lookups—Mappings are static key-value data structures inside a single template, not dynamic resource references. Similarly, Export declarations belong in the Outputs section, not the Mappings section.

The Trap (Distractor Analysis):
#

  • Why not A? Ref works only inside the same stack or nested stacks; it cannot resolve references across independently deployed stacks.
  • Why not C? The Mappings section is for YAML mapping data and does not connect to resources externally. Ignoring this causes confusion but is not a direct cause of failure.
  • Why not E? Export declarations aren’t placed in the Mappings section, but in Outputs. This is a misunderstanding of CloudFormation template structure.

The Technical Blueprint
#

Developer CLI snippet for Importing Exported Values:
#

Resources:
  AppSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      SubnetId: !ImportValue NexGenNetworkStack-PublicSubnetExports

To check exports in CLI:

aws cloudformation list-exports

To export a value in the network stack’s Outputs:

Outputs:
  PublicSubnetExport:
    Value: !Ref PublicSubnetId
    Export:
      Name: NexGenNetworkStack-PublicSubnetExports

The Comparative Analysis
#

Option API Complexity Performance Impact Use Case
A Incorrect Ref usage Fails cross-stack reference Works internally only
B (Correct) Uses ImportValue API Enables cross-stack share Essential for cross-stack
C Mapping misuse No effect on runtime Not related to resource ref
D (Correct) Requires Output Export Enables export/import chain Mandatory for sharing
E Misplaced Export Template invalid structure Export not in Mappings

Real-World Application (Practitioner Insight)
#

Exam Rule
#

For the exam, always pick ImportValue when you see references to resources from another CloudFormation stack.

Real World
#

In real deployments, teams often split network infrastructure and app stacks for flexibility and reuse. Correct use of Export/ImportValue ensures clean decoupling and safe resource sharing without hardcoding values or duplicating resources.


(CTA) Stop Guessing, Start Mastering
#


Disclaimer

This is a study note based on simulated scenarios for the AWS DVA-C02 exam.

The DevPro Network: Mission and Founder

A 21-Year Tech Leadership Journey

Jeff Taakey has driven complex systems for over two decades, serving in pivotal roles as an Architect, Technical Director, and startup Co-founder/CTO.

He holds both an MBA degree and a Computer Science Master's degree from an English-speaking university in Hong Kong. His expertise is further backed by multiple international certifications including TOGAF, PMP, ITIL, and AWS SAA.

His experience spans diverse sectors and includes leading large, multidisciplinary teams (up to 86 people). He has also served as a Development Team Lead while cooperating with global teams spanning North America, Europe, and Asia-Pacific. He has spearheaded the design of an industry cloud platform. This work was often conducted within global Fortune 500 environments like IBM, Citi and Panasonic.

Following a recent Master’s degree from an English-speaking university in Hong Kong, he launched this platform to share advanced, practical technical knowledge with the global developer community.


About This Site: AWS.CertDevPro.com


AWS.CertDevPro.com focuses exclusively on mastering the Amazon Web Services ecosystem. We transform raw practice questions into strategic Decision Matrices. Led by Jeff Taakey (MBA & 21-year veteran of IBM/Citi), we provide the exclusive SAA and SAP Master Packs designed to move your cloud expertise from certification-ready to project-ready.