Keep the useful bits, human.
Beginner field notes
- 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.
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?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 sampleVisual
The reviewed description and complete diagram source are available here.
More of this diagram is available inside its frame. Focus the frame and use the arrow keys to pan.
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
- AWS CloudFormation: Nested stacks
Used in: Quick notes · Worked example · Lesson text
Nested relationships, root/parent distinction, reusable definitions, parameter/output wiring, root operations and rollback coupling.
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
Used in: Quick notes · Worked example · Lesson text
Nested stack resource, parameter input constraints, Ref stack ID and output access. Cloud Control-only fields are excluded.
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
Used in: Quick notes · Worked example · Lesson text
Template/stack/resource distinction, parameterized reuse, create/update operations, proposed change sets and interruption/replacement/failure limits.
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.
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?
Why this answer?
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
Make this lesson yours
Save it for later, or tell your robot what would help.
This correction stays on this browser. Browse all concepts if the topic is missing.
Familiarity is your own assessment. To use it in your coding tool, download your updated learning profile.
Familiarity and lesson feedback are saved on this browser. They do not sync to your account or coding tool.