Lesson 1 of 3 Multi-Account Provisioning and Resource Sharing

Deploying Baselines Across Accounts with CloudFormation StackSets

This lesson explains how CloudFormation StackSets deploy the same template to many accounts and Regions from one place, the standard way to roll out baseline resources across an organisation.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe stack sets and stack instances.
  • Choose between self-managed and service-managed permissions.
  • Configure deployment options and troubleshoot failures.

StackSets and stack instances

A stack set holds a template and parameters in an administrator account. Deploying it to target accounts and Regions creates stack instances, each a reference to a real stack in that account and Region. Parameters can be overridden per account or Region. Updating the stack set updates every instance, and deleting stack instances (optionally retaining the stacks) removes them from management.

Permission models

StackSets use one of two permission models. With self-managed permissions, you create an AWSCloudFormationStackSetAdministrationRole in the administrator account and an AWSCloudFormationStackSetExecutionRole in every target account that trusts it; this works with any accounts, including those outside an organisation. With service-managed permissions, trusted access with AWS Organizations is enabled and StackSets creates the necessary roles automatically. You target OUs instead of account IDs, and automatic deployment creates stack instances in accounts that join the OU and optionally removes them from accounts that leave. Service-managed stack sets are created in the management account or a delegated administrator account.

Self-managed
RolesYou create administration and execution roles
TargetsAccount IDs
New accountsAdded manually
Accounts outside an organisationSupported
Service-managed
RolesCreated automatically through Organizations
TargetsOUs or the organisation (account filters possible)
New accountsAutomatic deployment
Accounts outside an organisationNot supported

The following diagram compares the two permission models.

The two StackSets permission models. With self-managed permissions, an administration role in the administrator account and an execution role in each target account must be created, which works for any account. With service-managed permissions, trusted access with Organizations creates the roles, OUs are targeted, and automatic deployment covers accounts that join later.
Service-managed permissions are the usual choice inside an organisation.
Sort into groups

Self-managed or service-managed?

Exam skills 3.1.4

Decide which StackSets permission model each statement describes.

Log in to try this activity Interactive activities are free with an account.

Deployment options and troubleshooting

Operation preferences control rollout: maximum concurrent accounts (number or percentage), failure tolerance (how many accounts may fail per Region before the operation stops), Region order and Region concurrency (sequential or parallel). Stack instance status shows CURRENT, OUTDATED (the last operation failed or did not reach it) or INOPERABLE. Common failures are a missing or untrusted execution role (self-managed), the Region not enabled in the target account, a resource that already exists with the same name, an SCP that denies the action, and service quotas. Drift detection can run across all stack instances.

Fill in the value

Rollout settings

Exam skills 3.1.4

Work out how StackSets operation preferences behave.

Log in to try this activity Interactive activities are free with an account.
Worked example

Baseline roles in every account

A company must ensure that every account, including those created in the future, has a read-only OpsAudit role trusted by the security account, and a CloudWatch cross-account observability link. The operator creates a service-managed stack set from a delegated administrator account, targets the root OU in two Regions with automatic deployment enabled and retain stacks on account removal disabled, and sets maximum concurrent accounts to 20% and failure tolerance to 1. When Account Factory creates a new account, the stack set deploys to it within minutes, with no manual step. Global resources such as IAM roles are deployed from one Region only, using a condition or a separate stack set, to avoid name conflicts.

Check yourself

Which settings control how fast a StackSet rolls out and when it stops?

Show answer

Maximum concurrent accounts and failure tolerance.

Exam Tips

Remember for the exam

  • Service-managed StackSets target OUs and deploy automatically to new accounts.
  • Self-managed StackSets need administration and execution roles you create.
  • Control rollout with maximum concurrent accounts and failure tolerance.
  • OUTDATED instances failed or were not reached; check execution roles, SCPs and enabled Regions.
  • Deploy global resources such as IAM roles from a single Region.