Automate CloudFormation StackSets with CloudFormation
CloudFormation StackSets rollout CloudFormation stacks to all or some of your AWS accounts. Also, stack sets allow you to deploy stacks to multiple regions. Therefore, CloudFormation stack sets are a great way to deploy baseline configurations to multiple accounts and regions. For example, we use CloudFormation stack sets to roll out baseline monitoring to all accounts belonging to our AWS organization. But how do you maintain CloudFormation stack sets? Amazingly, AWS announced a CloudFormation resource to manage CloudFormation stack sets recently.
The following CloudFormation template defines a stack set that deploys one of our open-source CloudFormation templates to configure a password policy in all AWS accounts of an organization.
Remember to enable stack sets for your organization before you proceed.
AWSTemplateFormatVersion: '2010-09-09' |
Just deploy a stack based on the above template in your organization’s management account (or delegated admin account), and that’s it.
Things that I like about the approach:
- Whenever you add a new account to your organization, the stack set will deploy the CloudFormation stack automatically.
- The CloudFormation template lets me easily update all stack sets and stacks by bumping the version in the
TemplateURL
. - Existing stack sets can be imported into CloudFormation to migrate manually managed stack sets.