Skip to content
Atlas, your robot learning host

Interim portrait

Atlas · Foundations cloudformation-nested-stacks

Hello, little human. I am Atlas. One useful idea is plenty for a beginning. Read the explanation, then explore an example.

Choose your robot No recording yet · text complete
concept for everyone
  • aws
  • devops

CloudFormation Nested Stacks

A nested stack is represented by a stack resource in a parent, so a separately defined template can be composed into a managed hierarchy.

Tune in, human.

Reviewed videos and Shorts

Captions requested · no autoplay

Finding reviewed videos…

    Keep the useful bits, human.

    Beginner field notes

    Choose explanation level
    • A CloudFormation nested stack is managed as a resource in another stack. Keeping two template files in one folder does not create that relationship.
    • The root is the top-level stack. A child’s immediate parent may be the root or another nested stack farther down the hierarchy.
    • Reusing a child template reuses its definition. Two child stack instances are not automatically one shared deployed resource.
    See a worked example

    Reuse one child definition while tracking two child instances

    One reviewed sample, shared across levels. Nothing here runs on your computer.

    Example review recorded 2026-10-17 · version 1.

    Example input · do not paste
    OFFLINE CloudFormation relationship table; teaching labels, not deployable syntax or real resource identifiers.
    Root stack: ArchiveRoot.
    StoragePlan definition: input Environment; resource logical name CatalogStore; output StoreId reports that resource identifier.
    Child logical name | Child template | Input Environment
    PreviewStorage     | StoragePlan    | preview
    TrainingStorage    | StoragePlan    | training
    Assume a separate authorized root creation has completed successfully for both children, without importing or sharing resources. Supplied child records: PreviewStorage StoreId=paper-store-preview; TrainingStorage StoreId=paper-store-training.
    Root output declaration: ActiveStoreId reads PreviewStorage.Outputs.StoreId through Fn::GetAtt.
    What is reused, which stacks are distinct, and which value is selected?
    Example output · do not paste
    Reused definition: StoragePlan, not one shared deployed storage resource.
    Distinct child stack instances: PreviewStorage and TrainingStorage; their common immediate parent and root is ArchiveRoot.
    Stated child resources: CatalogStore in PreviewStorage is paper-store-preview; CatalogStore in TrainingStorage is paper-store-training.
    ActiveStoreId = paper-store-preview, because the parent selects the PreviewStorage output. Reading Ref(PreviewStorage) would identify the child stack, not select StoreId.
    No extra deployment, update or resource sharing follows from writing this table.

    Follow the exact child instance and output name across the table. Both instances use one template definition, but their parameterized completed-operation records provide distinct resources and values. The output reference depends on the supplied preview result. Real stack operations and resource behavior require separate review; this paper trace performs none.

    Sources for this sample

    Visual

    The paper root has two distinct first-level storage children using the same template definition with different parameters. Each has its own stated resource identifier; the root output explicitly reads the preview child output. The diagram is not a deployment or a claim of shared resources.

    The reviewed description and complete diagram source are available here.

    Read the complete diagram source

    This is the source for the reviewed diagram, not a command to run.

    flowchart TD
      R["ArchiveRoot: root and immediate parent"] --> P["PreviewStorage child: Environment preview"]
      R --> T["TrainingStorage child: Environment training"]
      D["StoragePlan: one reusable definition"] -.-> P
      D -.-> T
      P --> A["CatalogStore: paper-store-preview"]
      T --> B["CatalogStore: paper-store-training"]
      P -.-> O["Root ActiveStoreId reads PreviewStorage Outputs.StoreId"]
    Full explanation and primary sources

    Reviewed explanation

    A CloudFormation nested stack is a stack managed as a resource of another stack, using AWS::CloudFormation::Stack to refer to its separately defined template. Nesting describes a managed relationship, not a directory layout. The top-level stack is the root; a deeper child can have a different immediate parent.

    The reusable piece is the child template’s definition. A parent can instantiate that definition more than once and pass named parameter values matching the child’s declared inputs. That does not automatically reuse an existing stack or share one storage resource; the example must distinguish each child instance and its supplied results.

    A child can expose an output value for its containing template. For example, Fn::GetAtt can select PreviewStorage.Outputs.StoreId using the child resource’s logical name and output name. Ref of PreviewStorage would instead identify the child stack itself. This is value wiring, not proof that an operation has run or that an output is a credential.

    In the Lantern Archive paper hierarchy, ArchiveRoot has PreviewStorage and TrainingStorage children using StoragePlan with different Environment inputs. Their completed-operation records provide two distinct StoreId values. The root’s ActiveStoreId explicitly reads the preview child’s output; it depends on that supplied result, not on the similarly named training value.

    Nested-stack updates should be managed through the parent/root operation as AWS recommends. Modified nested resources can change while unmodified ones are left alone; splitting templates is not a promise that everything updates, or that changes are isolated. A child stuck rolling back can hold up the root operation.

    Review the actual changed resources and their update behavior: updates may interrupt or replace resources, and change sets do not establish that an operation will succeed. The inventory below assumes completed creation, no imported/shared resources and no other changes. It is not a runnable template, an update procedure, or a guarantee about permission, naming, rollback or deletion outcomes.

    Source collection

    Notes AI source review · 2026-10-17

    AI source comparison recorded 2026-10-17. Human learner validation is pending.

    Quick quiz · one question

    Follow the selected child output

    Sample scenario. Synthetic offline Lantern Archive fixture. Both child creations are given complete/unshared; paper-stack-* are explicitly supplied teaching stack IDs,not credentials/AWS observations.

    Reusable definition
    StoragePlan; declared inputs Environment; output bindings StoreId reports CatalogStore. Root ArchiveRoot; given completed and unshared child creations.
    PreviewStorage
    Stack ID paper-stack-preview; template StoragePlan; parameters Environment=preview; inventory CatalogStore=paper-store-preview.
    TrainingStorage
    Stack ID paper-stack-training; template StoragePlan; parameters Environment=training; inventory CatalogStore=paper-store-training.
    Parent selection
    PreviewStorage.Outputs.StoreId

    Two children use StoragePlan with different Environment inputs. What is reused, how many child/resource instances are supplied, and which value does the parent select?

    Answers stay on this device.

    Sources and exercise scope
    • AWS CloudFormation: Split a template into reusable pieces using nested stacks

      Explains reusable child templates, root versus immediate parent, passing parameter values and exposing child outputs through a parent. Its operations section recommends root-originated updates and documents a child rollback delaying the root. Example identifiers, inputs and completed results are authored fiction.

    • AWS CloudFormation Template Reference: AWS::CloudFormation::Stack

      Defines the nested Stack resource, child Parameters names/values, parent access to Outputs through GetAtt and the distinct stack ID returned by Ref. Distinguishes modified and unmodified nested resources during parent updates. Cloud Control-only properties are not offered as deployable CloudFormation settings here.

    • AWS CloudFormation: How CloudFormation works

      Supports the plan/operation/stack-instance distinction and the qualifications that resource updates can interrupt or replace resources and change sets cannot guarantee update success. The draft does not turn an inventory example into actual creation or an operational safety guarantee.

    Original synthetic exercise. AI comparison against the reviewed lesson recorded on 2026-10-17; the references above state their scope. Human learner validation has not been run. A result here records this attempt; it does not establish mastery.

    Save or adjust this lesson
    Reference notes · file removal and public access

    Robot reference desk

    Understand what can change

    These reviewed public notes are available to everyone. They do not establish that an operation ran or inspect your files, backups or permissions.

    File removal

    Before deleting files: deleting a file can remove it without putting it in Trash or a recycle bin, and recovery is not guaranteed. Check the intended targets and whether a usable backup or recovery option exists before continuing.

    Sources for this note

    Public access

    Before making a resource public: public read access can let anyone view the exposed content, and public write access can allow changes to data. Check the actual audience, exposed content and allowed operations before continuing. This guidance does not inspect or change your permissions.

    Sources for this note

    A link can carry these public reference topics in its fragment. Page scripts, extensions, browser history and copied links can read them. This page attempts to minimize that fragment when JavaScript runs; reloading afterward can lose the selection. No project details or conversation text belong in a lesson link. Privacy details.