Skip to main content
  1. Projects/
  2. AWS DevOps Pro Certification/
  3. 2: Configuration Mgmt / Infrastructure as Code/
  4. 2: CloudFormation/

6: Nested Stacks / Cross-stack refs

·1 min

Why nested stacks?

  • Modularity
  • Reusability
  • Reuse smaller chunks of template in (perhaps hundreds of) parent templates
  • More OOP-style

Why cross-stack refs?

  • Get diff teams working on different template files
  • Export values from one stack to another related one
  • More API-style

How?

Nesting:

  • Use AWS::CloudFormation::Stack resource

Cross-stack:

  • Use cross-stack refs;
    • Use “output” section of templates
    • Use Fn::ImportValue to import outputs