Skip to main content
This guide shows how to create and manage AWS CloudFormation StackSets to deploy the same CloudFormation stack across multiple AWS accounts and Regions. It covers the required IAM roles, updating trust relationships, creating a StackSet with self‑managed permissions, verifying stack instances (S3 bucket example), and clean up. What you’ll learn
  • Create the administration and execution IAM roles required for StackSets
  • Update the execution role trust policy so the administration role can assume it
  • Create a StackSet using self‑managed permissions
  • Verify stack instances and the created resources (S3 buckets in this demo)
  • Delete stack instances and then delete the StackSet
Prerequisites
  • AWS account with IAM permissions to create roles and policies
  • Access to the CloudFormation console
  • The target account IDs and Regions where you’d like to deploy

Create the required IAM roles

First, create the two IAM roles that StackSets require: an administration role used by CloudFormation in the administering account and an execution role that CloudFormation assumes in target accounts/Regions. Open the IAM console, go to Roles, and create the first role.
A screenshot of the AWS Identity and Access Management (IAM) Dashboard showing security recommendations such as MFA status and unused access key info. The left sidebar displays IAM navigation items (Roles, Policies, IAM users) while the main panel lists green checkmarks for compliant settings.
Steps to create both roles:
  • Click Create role.
  • Choose “AWS service” as the trusted entity and select CloudFormation as the use case.
  • Attach the AdministratorAccess policy (or a scoped, least‑privilege policy appropriate for your templates).
  • Name the administration role exactly: AWSCloudFormationStackSetAdministrationRole.
  • Add a meaningful description and create the role.
Create the second role in the same way (AWS service → CloudFormation), attach the appropriate policy, and name it:
  • AWSCloudFormationStackSetExecutionRole
The execution role is what CloudFormation assumes in each target account/Region; the administration role is used by CloudFormation running in the administering account.
Screenshot of the AWS IAM Roles page in the AWS console, showing a list of IAM roles and a prominent orange "Create role" button. The header indicates 31 roles and lists items like AWSControlTowerAdmin and other service roles.
A screenshot of the AWS Management Console on the IAM "Create role" page showing a service selection dropdown listing commonly used services like EC2 and Lambda. The page footer shows Cancel and Next buttons for proceeding.
Roles quick reference
Prefer least privilege: instead of granting full AdministratorAccess to these roles, create a policy that allows only the CloudFormation actions and resource access your templates require.

Edit the execution role trust relationship

After creating both roles, update the execution role’s trust policy so it allows the administration role to assume it. This cross‑account trust is required for a self‑managed StackSet. Replace the Principal.AWS value with the ARN of the administration role in the administering account. Example trust policy (replace the account ID and role name with your values):
Steps:
  • Open the execution role AWSCloudFormationStackSetExecutionRole.
  • Go to the Trust relationships tab and choose Edit trust policy.
  • Update Principal.AWS to the administration role ARN (for example: arn:aws:iam::635573991785:role/AWSCloudFormationStackSetAdministrationRole).
  • Save the policy.
This change lets the administration role assume the execution role in target accounts/Regions so CloudFormation can create and manage resources there.

Create the StackSet (self‑managed permissions)

Now create the StackSet in the CloudFormation console and configure it to use the roles you created.
  • In CloudFormation, choose Create StackSet.
  • Under Permissions, select Self‑managed permissions (this uses the administration and execution roles you created).
A screenshot of the AWS CloudFormation "Create stack set" web console showing the Permissions section with the "Service-managed permissions" option selected and "Self-service permissions" as the alternative. The left side shows the step-by-step navigation (Specify details, Configure options, Set deployment options, Review).
  • Specify the administration role name: AWSCloudFormationStackSetAdministrationRole. CloudFormation will report that this role will be used to administer accounts.
  • Enter the execution role name: AWSCloudFormationStackSetExecutionRole — this is the role CloudFormation will assume in target accounts.
A screenshot of the AWS CloudFormation console on the "Create stack set" page, showing an IAM execution role name field ("AWSCloudFormationStackSetExecutionRole") and a warning that StackSets will use this role to administer individual accounts. The browser toolbar and AWS account/region header are visible at the top.
Upload or specify a CloudFormation template
  • Upload your template (in this demo: first-s3-bkt.yaml) or use a sample template from the console.
  • Click Next and specify a StackSet name (for example: DemoStackSet) and optional description/tags.
A screenshot of the AWS CloudFormation "Create stack set" page with the "Upload a template file" option selected and a chosen file named "first-s3-bkt.yaml." The browser shows the us-east-2 AWS console and the CloudWithDjango-Org account.
Specify target accounts and Regions
  • Choose “Deploy stacks in accounts” and enter the target AWS account number(s) (the account IDs where stack instances will be created).
  • Select the Regions where you want the stacks deployed (for example: us-east-2 and us-east-1).
  • Configure deployment options such as concurrency and failure tolerance (Sequential vs Parallel, max concurrent accounts per Region) and review the stackset settings. When ready, submit to create the StackSet.
A screenshot of the AWS CloudFormation "Create stack set" page showing the Deployment locations option set to "Deploy stacks in accounts" and an Account numbers field containing a 12-digit number (635573991785) with an "Upload .csv file" button. The browser tab and AWS console header are visible at the top.
A browser screenshot of the AWS CloudFormation "Create stack set" page showing deployment options (Sequential vs Parallel) and concurrency mode with "Strict failure tolerance" selected. An orange "Next" button is visible in the lower right.

Verify StackSet and stack instances

After submission CloudFormation runs a StackSet operation to deploy stack instances to the chosen accounts and Regions. Monitor the StackSet Overview and Instances tabs to check progress, operations, and per‑Region status.
A screenshot of the AWS CloudFormation console showing the "DemoStackSet: Stack set details" Overview page, with the stack set status marked ACTIVE and the Stack set ID and ARN displayed.
  • Open the Instances tab to see stack instance status for each Region. When the operation completes, instances should show SUCCEEDED.
  • Verify created resources in the target Regions. In this demo the template created S3 buckets in each Region; open the S3 console and refresh to confirm the buckets exist.
A screenshot of the Amazon S3 web console showing a "General purpose buckets" list with bucket names, AWS regions and creation dates, plus action buttons like "Create bucket."

Delete stack instances and the StackSet (cleanup)

To remove resources created via StackSets, you must first delete the stack instances and then delete the StackSet itself.
  • In the StackSet console choose Instances (or Actions → Delete stacks from stack set).
  • Select the target account(s) and Region(s) where stacks exist (for example: US East (Ohio) and US East (N. Virginia)).
  • Review and confirm to start the DELETE operation. CloudFormation will run a StackSet operation to delete stack instances in the specified locations.
A screenshot of the AWS CloudFormation StackSets page showing the "Specify Regions" step with US East (Ohio) and US East (N. Virginia) region selections. The UI appears to be in a workflow to delete stacks from a stack set, with region selection and remove buttons visible.
Monitor the Operations tab to track the delete operation progress; it will indicate when the operation is RUNNING and when it has SUCCEEDED.
A screenshot of the AWS CloudFormation console on the "DemoStackSet: Stack set details" page, showing the Operations tab with a DELETE operation currently RUNNING. The UI also shows search, "View drift details" and "Stop operation" buttons and indicates 0 stack instances selected.
After all stack instances are deleted:
  • Select the StackSet and choose Actions → Delete stack set to remove the StackSet itself.
A screenshot of the AWS Management Console showing the CloudFormation "StackSets" page. It displays an Active filter, a listed "DemoStackSet" entry, and a "Create stack set" button.
Verify instance statuses before deletion
  • Confirm instances report SUCCEEDED (or the expected terminal status) before initiating deletion if you need to preserve logs or outputs.
A screenshot of the AWS CloudFormation StackSets console showing "DemoStackSet: Stack set details" with a list of stack instances (US regions) and their statuses marked "SUCCEEDED." The page also shows a search box, "View drift results" button, and the AWS top navigation bar.
Important: Deleting resources is destructive. Always delete the inner stacks (stack instances) first, verify that all resources that must be retained are backed up, and then delete the outer StackSet.

Summary and best practices

  • CloudFormation StackSets enable centralized deployment and management of stacks across multiple AWS accounts and Regions.
  • Required IAM roles:
    • AWSCloudFormationStackSetAdministrationRole — used by the administering account to create/manage stack instances.
    • AWSCloudFormationStackSetExecutionRole — assumed in target accounts/Regions to perform resource creation.
  • Update the execution role trust policy so the administration role can assume it (cross‑account trust via sts:AssumeRole).
  • Create the StackSet using self‑managed permissions, specify target accounts and Regions, upload the template, configure deployment options, and deploy.
  • Clean up by deleting stack instances first, then deleting the StackSet.
Links and references Keywords: CloudFormation StackSets, StackSet administration role, StackSet execution role, cross-account deployment, cross-region deployment, AWS IAM trust policy, self-managed permissions

Watch Video