Create a New Stack Set
You can create a stack set in either the AWS Management Console, or by using AWS CloudFormation commands in the AWS CLI.
To create a stack set by using the AWS Management Console
-
Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.
-
At the top of the page, choose StackSets, and then choose Create stack set.
-
On the Select template page of the Create stack set wizard, choose Select a sample template from the following templates.
-
Choose the Enable AWS Config sample template, and then choose Next.
-
On the Specify details page of the wizard, provide the following information.
-
Provide a name for the stack set. Stack set names must begin with an alphabetical character, and contain only letters, numbers, and hyphens. In this walkthrough, we use the name
my-awsconfig-stackset.
-
You are prompted to specify values for parameters that are used by AWS Config. For more information about these parameters, see Setting up AWS Config with the Console in the AWS Config Developer Guide. In this walkthrough, we will leave default settings for all AWS Config parameters.
-
-
In the Delivery Channel Configuration area, you can configure the delivery channel for updates and notifications. For more information about the delivery channel in AWS Config, see Managing the Delivery Channel in the AWS Config Developer Guide. For the purposes of this walkthrough, we are leaving default settings in this area.
-
In the Delivery Notifications area, you can configure Amazon Simple Notification Service (SNS) updates by email, based on log content. For the purposes of this walkthrough, we are not configuring Amazon SNS updates.
-
When you are finished specifying parameters for AWS Config, choose Next.
-
On the Set deployment options page, provide the accounts and regions into which you want stacks in your stack set deployed. AWS CloudFormation deploys stacks in the specified accounts within the first region, then moves on to the next, and so on, as long as a region's deployment failures do not exceed a specified failure tolerance.
-
In the Accounts area, choose Deploy stacks in accounts. Paste your target account numbers in the text box, separating multiple numbers with commas.
-
In the Regions area, choose US West (Oregon) Region and then choose Add. Repeat for the US East (N. Virginia) Region. US West (Oregon) Region should be first in the Deployment order box.
-
In the Preferences area, keep the default value of 1 and By number for Maximum concurrent accounts. This means that AWS CloudFormation deploys your stack in only one account at one time. Keep Failure tolerance at the default value of 0, and keep the By number default option. This means that a maximum of one stack deployment can fail in one of your specified regions before AWS CloudFormation stops deployment in the current region, and cancels deployment in remaining regions. Choose Next.
-
-
On the Tags page, add a tag by specifying a key and value pair. In this walkthrough, we create a tag called Stage, with a value of Test. Tags that you apply to stack sets are applied to all resources that are created by your stacks. For more information about how tags are used in AWS, see Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide. After you specify the key-value pair, choose + to save the tag. Choose Next.
-
On the Review page, review your choices and your stack set's properties. To make changes, choose Edit in the area in which you want to change properties. Before you can create the stack set, you must fill the check box in the Capabilities area to acknowledge that some of the resources that you are creating with the stack set might require new IAM resources and permissions. For more information about potentially required permissions, see Acknowledging IAM Resources in AWS CloudFormation Templates in this guide. When you are are ready to create your stack set, choose Create.
-
AWS CloudFormation starts creating your stack set. View the progress and status of the creation of the stacks in your stack set in the Properties page that opens when you choose Create.
To create a stack set by using the AWS CLI
When you create stack sets by using AWS CLI commands, you run two separate commands:
create-stack-set to upload your template and create the stack set
container, and create-stack-instances to create the stacks within your
stack set. Start by running an AWS CLI command, create-stack-set, to
upload the sample AWS CloudFormation template that enables AWS Config, and then start
stack set
creation.
-
Open the AWS CLI.
-
Run the following command. For the
--template-urlparameter, provide the URL of the Amazon S3 bucket in which you are storing your template. For this walkthrough, we usemy-awsconfig-stacksetas the value of the--stack-set-nameparameter.aws cloudformation create-stack-set --stack-set-name my-awsconfig-stackset --template-url https://s3.amazonaws.com/cloudformation-stackset-sample-templates-us-east-1/EnableAWSConfig.yml -
After your
create-stack-setcommand is finished, run thelist-stack-setscommand to see that your stack set has been created. You should see your new stack set in the results.aws cloudformation list-stack-sets -
Run the
create-stack-instancesAWS CLI command to add stack instances to your stack set. In this walkthrough, we useus-west-2andus-east-1as the values of the--regionsparameter.Set the failure tolerance and maximum concurrent accounts by setting
FailureToleranceCountto0andMaxConcurrentCountto1in the--operation-preferencesparameter, as shown in the following example. To apply percentages instead, useFailureTolerancePercentageorMaxConcurrentPercentage. For the purposes of this walkthrough, we are using count, not percentage.aws cloudformation create-stack-instances --stack-set-name my-awsconfig-stackset --accounts '["account_ID_1","account_ID_2"]' --regions '["region_1","region_2"]' --operation-preferences FailureToleranceCount=0,MaxConcurrentCount=1Important
Wait until an operation is complete before starting another one. You can run only one operation at a time.
-
Verify that the stack instances were created successfully. Run
DescribeStackSetOperationwith theoperation-idthat is returned as part of the output of step 4.aws cloudformation describe-stack-set-operation --stack-set-name my-awsconfig-stackset --operation-idoperation_ID
