title: CloudFormation cross-stack vs nested-stack
body: <p>I'm facing a decision to <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html#cross-stack" rel="noreferrer">Use Cross-Stack References to Export Shared Resources</a> or to <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html#nested" rel="noreferrer">Use Nested Stacks to Reuse Common Template Patterns</a> following AWS CloudFormation best practices.</p>
  
  <p>However, they seem the same to me apart from a few differences:</p>
  
  <ul>
  <li>cross-stack uses <code>Fn::ImportValue</code>, templates are in one folder.</li>
  <li>nested-stack must be in S3, uses type <code>AWS::CloudFormation::Stack</code> and <code>TemplateURL</code>.</li>
  </ul>
  
  <p>There's no clear pros and cons between them as far as I could search.</p>
  
  <p>My goal is to create a <strong>parent stack</strong> that passes some core variables like <code>stackName</code> to the <strong>child stacks</strong>, then the <strong>child stacks</strong> create the resources sharing some variables between them like <code>ARN</code> or <code>Policies</code>, using the <code>stackName</code> to name their resources like <code>stackNameDynamoDBTable</code>.</p>