Courseiva
Configuration Management and IaCmediumMultiple ChoiceObjective-mapped

DOP-C02 Configuration Management and IaC Practice Question

A company uses AWS CloudFormation to deploy a multi-tier application. The network team manages the VPC and subnets using a separate CloudFormation stack. The application team needs to reference the VPC ID and subnet IDs from the network stack. Which approach should the application team use to obtain these values?

⚠ Common exam trap

A common mix-up: candidates confuse cross-stack references with nested stacks or parameter stores, but the exam specifically tests the Export/ImportValue pattern for decoupled stacks managed by different teams.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Export the VPC ID and subnet IDs from the network stack using the 'Export' field and import them in the application stack using Fn::ImportValue.

CloudFormation's Export and Fn::ImportValue mechanism allows cross-stack references without hardcoding or duplicating values. The network stack exports the VPC ID and subnet IDs using the Export field, and the application stack imports them via Fn::ImportValue, ensuring that changes in the network stack propagate automatically to dependent stacks.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Hardcode the VPC and subnet IDs in the application template.

    Why it's wrong here

    Hardcoding VPC and subnet IDs in the application template couples the app to specific infrastructure values that may change between environments (e.g., dev, prod) or when the network stack is recreated. It also eliminates CloudFormation's ability to track and validate resource dependencies, so if the VPC is replaced, the app stack will silently reference a non-existent network. This approach undermines portability, increases manual maintenance, and risks configuration drift because the template must be edited and redeployed for each environment.

  • Export the VPC ID and subnet IDs from the network stack using the 'Export' field and import them in the application stack using Fn::ImportValue.

    Why this is correct

    Exporting the VPC and subnet IDs from the network stack via the 'Export' field and importing them into the application stack with Fn::ImportValue establishes a native CloudFormation cross-stack reference within the same account and region. This creates an explicit dependency between the stacks, ensuring the network stack is created before the application stack and that the latest exported values are resolved at stack operation time. It avoids hardcoding by letting CloudFormation manage the wiring, and it supports updates and reuse across multiple dependent stacks. This is the intended, first-class mechanism for sharing outputs between independent CloudFormation stacks.

  • Create the network stack as a nested stack inside the application stack.

    Why it's wrong here

    Creating the network stack as a nested stack inside the application stack tightly couples the lifecycle of the network resources to the application stack—every time the application stack is updated or deleted, the nested network stack is also updated or deleted. This is problematic when the network infrastructure is shared across multiple application stacks, because nested stacks cannot be referenced by other top-level stacks, limiting reuse. It also increases the blast radius and complexity of updates, as a change to the network layer would be rolled out within the application stack's operation. For independent infrastructure that must be managed and reused separately, top-level stacks with cross-stack references are the correct pattern, not nested stacks.

  • Store the VPC and subnet IDs in AWS Systems Manager Parameter Store and retrieve them using dynamic references.

    Why it's wrong here

    Storing VPC and subnet IDs in Parameter Store and retrieving them via dynamic references is a valid pattern for configuration. However, for CloudFormation stacks to share outputs within the same account and region, CloudFormation's `Fn::ImportValue` is the direct and intended mechanism, eliminating the need for the network stack to explicitly write its outputs to Parameter Store. This approach would be suitable for sharing values across AWS accounts or regions, or for non-CloudFormation managed configuration and secrets.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

About these practice questions

This DOP-C02 question is part of Courseiva's 251-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.