AWS Developer DVA-C02 · Deployment · medium

In an AWS CloudFormation template, Stack A (NetworkStack) creates a production VPC and wants to export the VpcId so that Stack B (AppStack, in the same AWS account and region) can reference that VpcId dynamically without hardcoding vpc-0abc12345. Which pair of CloudFormation intrinsic functions / sections should be used in Stack A and Stack B?

Published · Last updated · checked before publication — how we verify questions

Options

  • AUse Fn::Base64 in Stack A's Parameters and Fn::GetAZs in Stack B across regions
  • BUse DeletionPolicy: Retain in Stack A's Resources and CreationPolicy in Stack B
  • CUse Fn::Split in Stack A's Mappings and Fn::Cidr in Stack B for subnet IP parsing
  • DExport the value in Stack A's Outputs and call Fn::ImportValue in Stack BCorrect answer

Answer: D. Export the value in Stack A's Outputs and call Fn::ImportValue in Stack B

To share values across CloudFormation stacks in the same account and region, Stack A declares an Outputs entry with an Export: Name (!Sub "${AWS::StackName}-VpcId"), and Stack B imports that exported value using the Fn::ImportValue (!ImportValue) intrinsic function.

Why the other options are wrong

  • A. Use Fn::Base64 in Stack A's Parameters and Fn::GetAZs in Stack B across regions — Fn::Base64 encodes UserData strings and Fn::GetAZs lists Availability Zones; neither shares cross-stack outputs.
  • B. Use DeletionPolicy: Retain in Stack A's Resources and CreationPolicy in Stack B — DeletionPolicy and CreationPolicy govern resource lifecycle behavior, not cross-stack variable references.
  • C. Use Fn::Split in Stack A's Mappings and Fn::Cidr in Stack B for subnet IP parsing — Fn::Split and Fn::Cidr manipulate strings and IP blocks locally within a single template.

All Deployment questions and the topic overview →

AWS and Amazon Web Services are trademarks of Amazon.com, Inc. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by Amazon Web Services.