Skip to content

Setting stack set regions during creation

0

As best I can tell, the CreateStackSet API does not allow you to specify which regions to deploy stacks to, when creating a service-managed stack set. Documentation for the AutoDeployment parameter does reference "in the specified Regions", but I cannot see any way to specify those regions during stack set creation.

I do see that the UpdateStackSet API includes a Regions.member.N parameter, which allows for specifying the regions to deploy stacks to.

When creating new stack sets through the CloudFormation Console, it is possible to specify the regions to deploy stacks during during the initial creation process.

Can someone explain what the process would be using the API that replicates what the Console is doing during a new stack creation? I understand that under the covers the Console may be doing a Create-then-Update in two steps, even though it's a single process in the UI. But I can't figure out what the parameters of the CreateStackSet operation would be, to create something without the regions specified.

asked 2 years ago624 views
2 Answers
1
Accepted Answer

I'm sorry, my fault, I misunderstood.

As described in Create a stack set with self-managed permissions using the AWS CLI:

When you create stack sets using the AWS CLI, you run two separate commands. During create-stack-set, you upload your template, create the stack set container, and manage automatic deployments. During create-stack-instances, you create stack instances in specific target accounts.

aws cli create-stack-set

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

aws cli create-stack-instances:

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=1

so about regions where the stacks within a stack set are deployed to , you need to refer to the Regions.member.N in the CreateStackInstance API.

CreateStackInstances:

Creates stack instances for the specified accounts, within the specified AWS Regions. A stack instance refers to a stack in a specific account and Region. You must specify at least one value for either Accounts or DeploymentTargets, and you must specify at least one value for Regions.

Regions.member.N

The names of one or more AWS Regions where you want to create stack instances using the specified AWS accounts.

Sample Request

https://cloudformation.us-east-1.amazonaws.com/
 ?Action=CreateStackInstances
 &Version=2010-05-15
 &StackSetName=stack-set-example
 &Regions.member.1=us-east-1
 &Regions.member.2=us-west-2
 &OperationPreferences.MaxConcurrentCount=5
 &OperationPreferences.FailureTolerancePercentage=10
 &Accounts.member.1=[account]
 &Accounts.member.2=[account]
 &OperationId=c424b651-2fda-4d6f-a4f1-20c0example
 &X-Amz-Algorithm=AWS4-HMAC-SHA256
 &X-Amz-Credential=[Access key ID and scope]
 &X-Amz-Date=20170810T233349Z
 &X-Amz-SignedHeaders=content-type;host
 &X-Amz-Signature=[Signature]
answered 2 years ago
EXPERT
reviewed a year ago
0

Hello.

According to my understanding.

As best I can tell, the CreateStackSet API does not allow you to specify which regions to deploy stacks to, when creating a service-managed stack set.

In fact, in the Examples of the CreateStackSet API you mentioned, you can see that the request address of the Sample Request is https://cloudformation.us-east-1.amazonaws.com/, where us-east-1 is the region where the stackset is created. If you open the Network of the developer tools in your browser and then switch regions in the Cloudformation console, you will find that the address in the Request URL will change. If you want to specify the region when calling the API, you only need to change the region in the request URL like:

Documentation for the AutoDeployment parameter does reference "in the specified Regions", but I cannot see any way to specify those regions during stack set creation.

I do see that the UpdateStackSet API includes a Regions.member.N parameter, which allows for specifying the regions to deploy stacks to.

The region you see here refers to the region of the account to which the substack is deployed, not the region where the stackset is located.

answered 2 years ago
  • The question is about regions where stacks within a stack set (substacks, as you call them) are deployed to, not about where the stack sets themselves are being deployed.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.