AWS Certified CloudOps Engineer Associate SOA-C03 [2026]

AWS CloudFormation Stacks, Stack Sets, and Nested Stacks

Learn how AWS CloudFormation stacks, stack sets, and nested stacks support resource lifecycle management, multi-account and multi-Region deployment, and reusable infrastructure templates.

AWS Certified CloudOps Engineer Associate SOA-C03 [2026]AWS Certified CloudOps Engineer Associate SOA-C03 [2026]Updated Sep 1, 2026
Study options
WatchComing later
ListenComing later
ReadAvailable
ReviewComing later

Study guide

Technical reference and lesson notes

AWS CloudFormation Stacks, Stack Sets, and Nested Stacks

Purpose of This Lesson

This lesson explains three CloudFormation deployment structures:

  • Stacks, which manage resources defined by a CloudFormation template.
  • Stack sets, which deploy related stacks across multiple AWS accounts and Regions.
  • Nested stacks, which organize and reuse CloudFormation templates for standardized components.

For the AWS Certified CloudOps Engineer Associate context, the key skill is recognizing which structure fits a deployment requirement and understanding the operational consequences of stack failures and rollback.

Key Concepts

CloudFormation stacks

A CloudFormation stack is a collection of AWS resources deployed from a CloudFormation template. The template defines the desired resources and configuration, while the stack provides the lifecycle boundary for those resources.

Stacks can be created, updated, and deleted through:

  • The AWS Management Console
  • The AWS Command Line Interface (CLI)
  • AWS APIs

A stack is the normal choice when resources are being managed within a deployment scope such as an account and Region.

Automatic rollback

Automatic rollback on stack creation error is enabled by default. If CloudFormation encounters a problem during creation, it attempts to roll back the operation by terminating or deleting resources that were created as part of that attempt.

Rollback does not mean the failed operation is free. AWS can charge for resources that existed or were used before the error occurred, even when the stack ultimately fails and rolls back.

Stack sets

A stack set allows an administrator to create, update, or delete stacks across multiple AWS accounts and Regions through a single operation.

Important roles and boundaries are:

  • Administrator account: The AWS account where the stack set is created and managed.
  • Target account: An AWS account into which one or more stacks from the stack set are deployed, updated, or deleted.

The stack set is managed by signing in to the administrator account in which it was created. Stack sets are therefore suited to centralized, repeatable deployment across account and Region boundaries.

Nested stacks

A nested stack is a stack referenced from another CloudFormation template. The top-level stack is commonly called the root stack. The root stack can call one or more child templates, and a nested stack can itself contain additional nested stacks.

Nested stacks support reuse of CloudFormation code for common infrastructure patterns, such as:

  • Load balancer configurations
  • Web server configurations
  • Application server configurations
  • VPC configurations

Instead of repeating the same resource definitions in every main template, an organization can create standardized templates for common components and reference them from other templates.

Deployment Structure and Operational Behavior

Stack lifecycle

A stack template is the source used to create, update, or delete the resources in that stack. During creation, CloudFormation may provision several resources in sequence. If a later resource fails, automatic rollback attempts to remove resources created during the failed operation.

Operationally, investigate both the triggering error and the rollback result. A rollback can remove the resources that would otherwise help with diagnosis, and resource usage before failure may still generate charges.

Centralized multi-account and multi-Region deployment

Stack sets extend the stack model beyond a single deployment target. One administrator account manages the stack set, while target accounts receive the individual stacks. The same stack set operation can address multiple target accounts and Regions.

This makes stack sets appropriate when the requirement is centralized consistency across organizational boundaries rather than reuse of a template inside one application or infrastructure composition.

Hierarchical template composition

Nested stacks provide a hierarchy of templates:

Root stack
├── Nested stack: networking or VPC component
├── Nested stack: load balancer component
└── Nested stack: application or web server component
    └── Additional nested stack, if required

The hierarchy allows common components to be standardized while the root stack composes them into a complete deployment. Nested stacks are not primarily a multi-account deployment mechanism; their main purpose in this lesson is reusable CloudFormation structure.

Exam- or Assessment-Relevant Takeaways

  • A stack is a resource collection deployed and managed from a CloudFormation template.
  • Stacks can be managed through the AWS Management Console, AWS CLI, or APIs.
  • Automatic rollback on creation error is enabled by default and attempts to terminate or delete resources created during the failed operation.
  • A failed stack creation can still incur charges for resources used before the failure or during rollback.
  • A stack set is the correct CloudFormation structure for creating, updating, or deleting stacks across multiple AWS accounts and Regions in one operation.
  • The administrator account is where the stack set is created and managed.
  • A target account receives one or more stacks from the stack set.
  • A nested stack is a reusable template referenced by a parent or root stack.
  • Nested stacks can themselves contain nested stacks, forming a hierarchy.
  • Choose stack sets for centralized multi-account or multi-Region deployment; choose nested stacks for reusable, modular template components.

Tool / Feature Decision Guide

RequirementBest fitReason
Deploy and manage a group of resources from one template in a deployment scopeCloudFormation stackA stack is the standard lifecycle boundary for template-defined resources.
Create, update, or delete equivalent stacks in several AWS accounts and RegionsCloudFormation stack setA stack set performs the operation centrally across target accounts and Regions.
Reuse a standardized VPC, load balancer, web server, or application server definitionNested stackThe root template can reference a reusable child template.
Organize a large deployment into reusable hierarchical componentsNested stacksA root stack can compose multiple child stacks, including further nested stacks.
Respond to a stack creation failureStack rollback behaviorAutomatic rollback attempts to remove resources created by the failed operation, although charges may still apply.

Common Traps / Misconceptions

  • A stack set is not simply a larger nested stack. Stack sets address deployment across multiple accounts and Regions; nested stacks address template reuse and composition.
  • Rollback does not guarantee zero cost. Resources may incur charges before the creation error or while they exist during the operation.
  • The target account does not manage the stack set. The stack set is created and managed in the administrator account; target accounts receive the resulting stacks.
  • Nested stacks are not limited to one child level. A nested stack can contain additional nested stacks.
  • A stack is not the template itself. The template defines the desired resources, while the stack is the deployed resource collection managed through that template.
  • A failed deployment may not leave all resources available for inspection. Automatic rollback attempts to terminate or delete resources created during the failed operation.

Real-World Engineer / Analyst Notes

  • Before troubleshooting a failed stack, capture the CloudFormation events and identify the first resource failure. Later rollback events may be consequences rather than the root cause.
  • Treat rollback as a lifecycle behavior, not as a cost-protection mechanism. Review which resources may have been provisioned before the failure.
  • Use nested stacks when repeated infrastructure patterns need a single maintained definition. This reduces duplication and helps standardize common components.
  • Use stack sets when the primary operational problem is consistent deployment across account or Region boundaries.
  • Keep the administrator-versus-target account distinction clear in operational procedures. The account receiving a stack is not necessarily the account that owns and manages the stack set.
  • A hierarchical design can improve organization, but operators should understand which root or nested component owns the resource involved in a failure or update.

Quick Reference Summary

FeatureScopePrimary purposeKey operational detail
StackA CloudFormation deployment scopeDeploy and manage template-defined resourcesCreation rollback is enabled by default and may still incur charges
Stack setMultiple AWS accounts and RegionsCentrally deploy, update, or delete stacksManaged from the administrator account; stacks are placed in target accounts
Nested stackWithin a parent/root stack hierarchyReuse and modularize CloudFormation templatesNested stacks can contain additional nested stacks

Flashcards

Q: A team must deploy the same CloudFormation-defined resources into several AWS accounts and Regions with one coordinated operation. Which feature should it choose?

A: Use a CloudFormation stack set. Stack sets centrally create, update, or delete stacks across multiple target accounts and Regions.

Q: Where is a stack set created and managed, and where are its deployed stacks placed?

A: The stack set is created and managed in the administrator account. Its individual stacks are deployed into target accounts.

Q: When should nested stacks be preferred over stack sets?

A: Use nested stacks when the goal is to reuse and compose standardized CloudFormation templates, such as VPC, load balancer, or server components. Use stack sets when the goal is deployment across accounts or Regions.

Q: What happens by default when CloudFormation encounters an error during stack creation?

A: Automatic rollback attempts to terminate or delete resources created during the failed operation.

Q: What is the cost-related trap associated with CloudFormation rollback?

A: Rollback does not erase usage charges. Resources used or provisioned before the failure can still generate charges even if CloudFormation later deletes them.

Q: A root template references a reusable template for a standard load balancer configuration. What CloudFormation pattern is being used?

A: This is a nested stack. The root stack references a child template that defines the standardized load balancer resources.

Q: Can a nested stack contain another nested stack?

A: Yes. Nested stacks can form a hierarchy in which a nested stack references additional templates containing specific resources or resource groups.

Q: What is the difference between a CloudFormation template and a stack?

A: The template defines the desired resources and configuration. The stack is the deployed collection of those resources that CloudFormation creates, updates, and deletes.

Q: Which interfaces can be used to create, update, and delete CloudFormation stacks according to the lesson?

A: The AWS Management Console, AWS CLI, and AWS APIs can be used to manage stacks.

Q: An organization wants one maintained definition for common VPC and application-server configurations used by several deployments. Which design is most appropriate?

A: Use nested stacks with reusable templates for the common components. Each root stack can reference the standardized child templates.

Q: What is the decisive account distinction in a stack set deployment?

A: The administrator account owns and manages the stack set, while a target account is where one or more resulting stacks are created, updated, or deleted.

Q: Why might a failed stack be difficult to troubleshoot after the operation finishes?

A: Automatic rollback may terminate or delete resources created during the failed attempt, removing temporary resources that could otherwise have been inspected.

Practice Questions

Question 1

A platform team needs to deploy a standard CloudFormation configuration to accounts in several AWS Regions. The team wants to initiate the operation centrally from one AWS account. Which option best meets the requirement?

A. A single CloudFormation stack
B. A nested stack
C. A CloudFormation stack set
D. Separate templates with no stack relationship

Correct answer: C. A stack set is designed to create, update, or delete stacks across multiple accounts and Regions from an administrator account.

Question 2

A CloudFormation stack fails while creating its final resource. The earlier resources are automatically removed. Which behavior explains this result?

A. Stack set synchronization
B. Nested stack inheritance
C. Automatic rollback on error
D. Target-account delegation

Correct answer: C. Automatic rollback is enabled by default and attempts to terminate or delete resources created during a failed stack operation.

Question 3

An engineering organization repeats the same VPC and load balancer resource definitions in many CloudFormation templates. It wants to maintain each common definition once and reference it from larger deployments. What should the organization use?

A. Stack sets
B. Nested stacks
C. Manual console deployment
D. A target account

Correct answer: B. Nested stacks allow reusable child templates to be referenced from a root or parent stack.

Question 4

An engineer signs in to an account that receives stacks from a stack set and attempts to modify the stack set itself. What is the likely issue?

A. The engineer is in a target account rather than the administrator account.
B. Nested stacks cannot be updated after creation.
C. Stack sets only support one Region.
D. CloudFormation stacks cannot be managed through an account.

Correct answer: A. The stack set is managed from the administrator account in which it was created; target accounts receive the deployed stacks.

Question 5

A team assumes that a failed CloudFormation creation incurs no charges because automatic rollback deletes the resources. Which response is most accurate?

A. Correct; rollback prevents all resource charges.
B. Correct; CloudFormation bills only successfully completed stacks.
C. Incorrect; resources used before the failure can still incur charges.
D. Incorrect; rollback permanently converts the resources into a stack set.

Correct answer: C. Resources may be charged for usage even if the stack creation fails and rollback later terminates or deletes them.

WordPress Metadata

Suggested Slug:
aws-cloudformation-stacks-stack-sets-nested-stacks

Meta Description:
Learn how AWS CloudFormation stacks, stack sets, and nested stacks support resource lifecycle management, multi-account and multi-Region deployment, and reusable infrastructure templates.

Tags:
AWS CloudFormation, CloudFormation stacks, CloudFormation StackSets, nested stacks, infrastructure as code, AWS accounts, AWS Regions, stack rollback, deployment automation