Skip to main content
In this lesson you’ll learn how to create and manage an AWS CloudFormation StackSet to deploy the same CloudFormation stack across multiple AWS accounts and Regions. This guide covers the required IAM roles, trust policies, creating a service-managed StackSet, monitoring deployments, and cleaning up. Key concepts include cross-account deployment, service-managed permissions, and the two required roles:
  • AWSCloudFormationStackSetAdministrationRole — in the administrator (management) account.
  • AWSCloudFormationStackSetExecutionRole — in each target account (or in the same account for single-account testing).
Use this step-by-step procedure to ensure StackSets can assume roles across accounts and deploy consistently across Regions.
Quick checklist
  • Create administration and execution IAM roles using the exact names above.
  • Set correct trust relationships (CloudFormation service for admin; admin role ARN for execution).
  • Use Service-managed permissions when creating the StackSet (simplest option).
  • Delete stack instances first when cleaning up, then delete the StackSet.
  1. Create the administration role
  • Open the IAM console and navigate to Roles → Create role.
  • Choose AWS service as the trusted entity and select CloudFormation as the use case.
  • Attach the AdministratorAccess policy (or a scoped policy that fits your organization).
  • Name the role exactly: AWSCloudFormationStackSetAdministrationRole.
  • Create the role.
A screenshot of the AWS Management Console on the IAM "Roles" page, showing a list of IAM roles (31) with columns for role name and trusted entities. A prominent orange "Create role" button is visible at the top right.
  1. Create the execution role
  • In IAM, create another role with the exact name: AWSCloudFormationStackSetExecutionRole.
    • Recommended: choose “Another AWS account” and specify the administrator account ID as the trusted principal. This sets the admin account as the allowed principal to assume this role.
    • Alternative: create the role via AWS service → CloudFormation, then edit its trust policy to allow the admin role ARN to assume it.
  • Attach AdministratorAccess (or a scoped policy that grants permission to create the resources in your template).
  • This execution role will be assumed by the administration role when CloudFormation deploys resources into target accounts.
A screenshot of the AWS IAM "Create role" page showing a service/use-case dropdown with entries like EC2, Lambda, Agent Registry, and Amazon Aurora. The console header and navigation (account name and Next/Cancel buttons) are also visible.
  1. Configure the execution role trust relationship
  • If the execution role was created with a service principal (for example cloudformation.amazonaws.com), edit the role’s trust policy so it trusts the administration role ARN in the administrator account. This change allows the administration role to assume the execution role in the target account.
  • Example trust policy for the administration role (CloudFormation service assumes this admin role):
  • Example trust policy for the execution role (replace 123456789012 with your administrator account ID):
A screenshot of the AWS CloudFormation "StackSets" console showing the Delegated administrators section (0) and an empty StackSets list with a "Create stack set" button. The page includes search/filter controls and buttons to register or deregister a delegated administrator.
When editing the execution role trust policy, use your administrator account ID and the exact role name AWSCloudFormationStackSetAdministrationRole. Any typo in the role name or account ID will prevent StackSets from assuming the execution role.
  1. Create a StackSet (service-managed permissions)
  • In the CloudFormation console choose StackSets → Create stack set.
  • For Permissions, select Service-managed permissions. With this option, the CloudFormation service manages cross-account/region operations and permissions for you.
  • Enter the administration role name: AWSCloudFormationStackSetAdministrationRole.
  • For the execution role name, enter AWSCloudFormationStackSetExecutionRole.
A screenshot of the AWS CloudFormation "Create stack set" permissions page showing radio options for Service-managed permissions and Self-service permissions and a left-side step progress menu. The AWS console header and browser tabs are visible across the top.
A screenshot of the AWS CloudFormation "Create stack set" console with the IAM admin role dropdown open, showing options like "No role selected" and various AWS stack set roles. Browser tabs and the AWS account/region header are also visible.
Screenshot of the AWS CloudFormation console on the "Create stack set" page, showing the IAM execution role field filled with "AWSCloudFormationStackSetExecutionRole" and a highlighted warning that StackSets will use this role to administer individual accounts.
  1. Provide the template and deployment targets
  • Upload a CloudFormation template (YAML or JSON). For demonstrations, a simple template that creates an S3 bucket is sufficient.
  • Provide the StackSet name (for example DemoStackSet), description, parameter values, and tags as needed.
  • Under Deployment options:
    • Accounts: add one or more target account IDs. For a single-account demo, you can use the same account ID as the admin account.
    • Regions: select the AWS Regions where you want StackSet instances created.
A screenshot of the AWS CloudFormation "Create stack set" console with the "Upload a template file" option selected and a file named "first-s3-bkt.yaml" chosen. The page also shows alternatives like using an Amazon S3 URL or a stack ID.
  • Example: specify your account number(s) in the Accounts field.
Screenshot of the AWS CloudFormation "Create stack set" page. It shows deployment location options and an Account numbers input field populated with 635573991785 and an "Upload .csv file" button.
  • Choose Regions (for example us-east-2 and us-east-1), adjust concurrency and failure tolerance (defaults are often fine for demos), then submit the StackSet creation.
A screenshot of the AWS CloudFormation "Create stack set" page showing deployment options (Sequential vs Parallel) and concurrency mode with "Strict failure tolerance" selected. Navigation buttons (Cancel, Previous, Next) are visible, with the Next button highlighted.
  1. Monitor the StackSet operation
  • Once submitted, CloudFormation runs an operation to create stack instances in the selected Regions/accounts. Monitor progress on the StackSet details page and check the stack instance statuses.
  • When the operation completes, you should see stack instances for each chosen Region/account. For templates that create S3 buckets, verify the buckets exist in each selected Region.
A screenshot of the AWS CloudFormation console showing the "DemoStackSet: Stack set details" page with an Overview panel that lists the stack set status as ACTIVE and displays the stack set ID and ARNs. The browser header with tabs and the AWS account/org name is visible at the top.
A screenshot of the Amazon S3 console showing "General purpose buckets" with bucket names, AWS regions and creation dates. The top right shows action buttons like Create bucket, Copy ARN, Empty, and Delete.
  • Use the StackSet instances table to confirm status broken down by account and Region.
A screenshot of the AWS CloudFormation console on the "DemoStackSet: Stack set details" page showing the "Stack instances" section with a search bar and a table of columns like AWS account, AWS Region, Stack ID and status. Partial stack ARNs and IDs are visible in the table.
  1. Clean up (delete instances, then the StackSet)
  • Delete stack instances first:
    • Select the StackSet → Actions → Delete stacks.
    • Choose the account(s) and Region(s) to remove instances from, and submit the delete operation.
  • After stack instances are removed, delete the StackSet itself:
    • Select the StackSet and choose Actions → Delete stack set.
A screenshot of the AWS CloudFormation "StackSets" console showing one stack set (DemoStackSet) with the filter status set to Active. The page includes a "Create stack set" button and navigation/header elements.
Delete StackSet stack instances before deleting the StackSet itself. Deleting the StackSet does not remove existing stack instances; failing to delete instances first can leave orphaned stacks that require manual cleanup.
Reference table — required roles and purpose Summary
  • Create two IAM roles with exact names: AWSCloudFormationStackSetAdministrationRole (admin) and AWSCloudFormationStackSetExecutionRole (execution).
  • Configure the administration role so CloudFormation can assume it (service principal).
  • Edit the execution role trust policy to allow the administration role ARN to assume the execution role.
  • Create a service-managed StackSet, specify admin and execution role names, upload a template, and target the desired accounts and Regions.
  • For teardown, delete stack instances first, then delete the StackSet.
Links and references That completes this lesson on creating and using CloudFormation StackSets to deploy and manage a stack across multiple Regions and accounts.

Watch Video