Creates stack instances within a specified account in a specified region.

Before you call this operation, make sure that a stack group is created. For more information, see CreateStackGroup.

In this example, stack instances are created in a stack group named MyStackGroup. The stack instances are created within the 151266687691∗∗∗∗ and 141261387191∗∗∗∗ Alibaba Cloud accounts in the China (Hangzhou) and China (Beijing) regions. The stack group is granted self-managed permissions and created in the China (Hangzhou) region.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateStackInstances

The operation that you want to perform. Set the value to CreateStackInstances.

RegionId String Yes cn-hangzhou

The region ID of the stack group. You can call the DescribeRegions operation to query the most recent region list.

StackGroupName String Yes MyStackGroup

The name of the stack group. The name must be unique within a region.

The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). It must start with a digit or letter.

AccountIds Array of String No ["151266687691****", "141261387191****"]

The IDs of the accounts within which you use the self-managed permission model to deploy stacks. You can specify a maximum of 20 account IDs.

RegionIds Array of String Yes ["cn-hangzhou","cn-beijing"]

The region IDs of the stack instances. You can specify a maximum of 20 region IDs.

ClientToken String No 123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests.

The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see Ensure idempotence.

OperationDescription String No Create stack instances in hangzhou and beijing

The description of the operation to create the stack instances.

The description must be 1 to 256 characters in length.

OperationPreferences Map No {"FailureToleranceCount": 1, "MaxConcurrentCount": 2}

The preferences of the operation to create the stack instances.

Available parameters for the operation preferences:

  • {"FailureToleranceCount": N}

    The maximum number of stack operation failures that can occur within the accounts in each region. When the value is exceeded, Resource Orchestration Service (ROS) stops the operation in the region. If ROS stops the operation in one region, ROS stops the operation in other regions.

    Valid values of N: 0 to 20.

    If you do not specify the FailureToleranceCount parameter, the default value 0 is used.

  • {"FailureTolerancePercentage": N}

    The percentage of the total number of accounts within which stack operation failures can occur to the total number of accounts in each region. When the value is exceeded, ROS stops the operation in the region.

    Valid values of N: 0 to 100. If the numeric value in the percentage is not an integer, ROS rounds the number down to the nearest integer.

    If you do not specify the FailureTolerancePercentage parameter, the default value 0 is used.

  • {"MaxConcurrentCount": N}

    The maximum number of accounts within which operations are concurrently performed on stacks in each region.

    Valid values of N: 1 to 20.

    If you do not specify the MaxConcurrentCount parameter, the default value 1 is used.

  • {"MaxConcurrentPercentage": N}

    The percentage of the total number of accounts within which operations are concurrently performed on stacks to the total number of accounts in each region.

    Valid values of N: 1 to 100. If the numeric value in the percentage is not an integer, ROS rounds the number down to the nearest integer.

    If you do not specify the MaxConcurrentPercentage parameter, the default value 1 is used.

Separate multiple parameters with commas (,).

Note
  • You can specify one of the MaxConcurrentCount and MaxConcurrentPercentage parameters.
  • You can specify one of the FailureToleranceCount and FailureTolerancePercentage parameters.
TimeoutInMinutes Long No 10

The timeout period to create the stack instances.

  • Default value: 60.
  • Unit: minutes.
DisableRollback Boolean No false

Specifies whether to enable rollback when the stack instances fail to be created.

Default value: false. Valid values:

  • true: disables rollback when the stack instances fail to be created.
  • false: enables rollback when the stack instances fail to be created.
DeploymentTargets Object No

The folders in which you use the service-managed permission model to deploy stacks.

RdFolderIds Array of String Yes ["fd-4PvlVLOL8v"]

The folder IDs of the resource directory. You can add a maximum of five folder IDs.

You can create stack instances in all the member accounts that are contained in the specified folders. If you create stack instances in the Root folder, the stack instances are created in all the member accounts in the resource directory.

Note To view the folder IDs, go to the overview page in the Resource Management console. For more information, see View the basic information about a folder.
ParameterOverrides.N.ParameterKey String Yes Amount

The key of override parameter N. If you do not specify the key of this parameter, ROS uses the key that you specify when you create the stack group.

Maximum value of N: 200.

Note
  • ParameterOverrides in ParameterOverrides.N.ParameterKey is optional.
  • If you specify ParameterOverrides, you must specify the ParameterOverrides.N.ParameterKey and ParameterOverrides.N.ParameterValue parameters.
ParameterOverrides.N.ParameterValue String Yes 1

The value of override parameter N. If you do not specify the value of this parameter, ROS uses the value that you specify when you create the stack group.

Maximum value of N: 200.

Note
  • ParameterOverrides in ParameterOverrides.N.ParameterValue is optional.
  • If you specify ParameterOverrides, you must specify the ParameterOverrides.N.ParameterKey and ParameterOverrides.N.ParameterValue parameters.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String 14A07460-EBE7-47CA-9757-12CC4761D47A

The ID of the request.

OperationId String 6da106ca-1784-4a6f-a7e1-e723863d****

The ID of the operation.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=CreateStackInstances
&AccountIds=["151266687691****","141261387191****"]
&RegionId=cn-hangzhou
&RegionIds=["cn-hangzhou","cn-beijing"]
&StackGroupName=MyStackGroup
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateStackInstancesResponse>
        <RequestId>14A07460-EBE7-47CA-9757-12CC4761D47A</RequestId>
        <OperationId>6da106ca-1784-4a6f-a7e1-e723863d****</OperationId>
</CreateStackInstancesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "14A07460-EBE7-47CA-9757-12CC4761D47A",
  "OperationId" : "6da106ca-1784-4a6f-a7e1-e723863d****"
}

Error codes

For a list of error codes, visit the API Error Center.

Error code

Error message

HTTP status code

Description

StackInstanceExists

The StackInstance ({instance}) already exists.

409

The error message returned because a stack instance whose name is the same as the specified stack instance exists within the specified account in the specified region. instance indicates the name of the stack instance.

StackGroupOperationInProgress

Another Operation on StackGroup ({name}) is in progress.

409

The error message returned because an operation is being performed on the stack group. name indicates the name of the stack group.