All Products
Search
Document Center

Resource Orchestration Service:CreateStackInstances

Last Updated:Dec 19, 2025

Creates stack instances for one or more accounts in the specified regions.

Operation description

Prerequisites

Ensure that a stack group is created. For more information, see CreateStackGroup.

Scenarios

Create stacks across accounts

To create identical resources in multiple accounts, an administrator account can create a stack group, add multiple destination accounts, and deploy resources in a single region. This process creates multiple stacks in different accounts within the same region, improving deployment efficiency.

Create stacks across regions

To create identical resources in multiple regions, an administrator account can create a stack group, add a destination account, and deploy resources in multiple regions. This process creates multiple stacks in different regions within the same account, improving deployment efficiency.

Create stacks across accounts and regions

To create identical resources in multiple accounts across multiple regions, an administrator account can create a stack group, add multiple destination accounts, and deploy resources in multiple regions. This process creates multiple stacks in different accounts across different regions, improving deployment efficiency.

This topic provides an example of creating stacks in the China (Hangzhou) and China (Beijing) regions in the Alibaba Cloud accounts 151266687691**** and 141261387191****. The example uses a stack group named MyStackGroup that is created in the China (Hangzhou) region and uses self-managed permissions.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ros:CreateStackInstances

create

*StackInstance

acs:ros:{#regionId}:{#accountId}:stackinstance/{#StackGroupName}/{#StackInstanceAccountId}/{#StackInstanceRegionId}

None

None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the stack group.

You can call the DescribeRegions operation to query the latest list of Alibaba Cloud regions.

cn-hangzhou

StackGroupName

string

Yes

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

MyStackGroup

AccountIds

array

No

The IDs of the destination accounts where you want to create stacks using self-managed permissions. You can specify up to 50 account IDs.

Note

You can specify only one of the AccountIds and DeploymentTargets parameters.

["151266687691****","141261387191****"]

string

No

The IDs of the destination accounts where you want to create stacks using self-managed permissions. You can specify up to 50 account IDs.

Note

You can specify only one of the AccountIds and DeploymentTargets parameters.

["151266687691****", "141261387191****"]

RegionIds

array

Yes

The IDs of the destination regions. You can specify up to 20 region IDs.

["cn-hangzhou", "cn-beijing"]

string

No

The IDs of the destination regions. You can specify up to 20 region IDs.

["cn-hangzhou","cn-beijing"]

ClientToken

string

No

A client token that is used to ensure the idempotence of the request. The client generates the token, which must be globally unique.
The token can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_).
For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-42665544****

OperationDescription

string

No

The description of the operation to create the stacks.

The description must be 1 to 256 characters in length.

Create stack instances in hangzhou and beijing

OperationPreferences

object

No

The preferences for the operation.

The following parameters are available:

  • {"FailureToleranceCount": N}

    The number of accounts per region in which the operation can fail. If the number of failed operations in a region exceeds this value, Resource Orchestration Service (ROS) stops the operation in that region. If the operation is stopped in a region, the operation is not performed in other regions.

    The value of N can be an integer from 0 to 20.

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

  • {"FailureTolerancePercentage": N}

    The percentage of accounts per region in which the operation can fail, relative to the total number of accounts. If the percentage of failed operations in a region exceeds this value, ROS stops the operation in that region.

    The value of N can be an integer from 0 to 100. If the percentage is not an integer, ROS rounds down the value.

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

  • {"MaxConcurrentCount": N}

    The maximum number of accounts in each region where stacks can be deployed at the same time.

    The value of N can be an integer from 1 to 20.

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

  • {"MaxConcurrentPercentage": N}

    The percentage of accounts in each region where stacks can be deployed at the same time, relative to the total number of accounts.

    The value of N can be an integer from 1 to 100. If the percentage is not an integer, ROS rounds down the value.

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

  • {"RegionConcurrencyType": N}
    The concurrency type of deployment regions. Valid values:

    • SEQUENTIAL (default): Deploys stacks in the specified regions one by one. Stacks are deployed in only one region at a time.

    • PARALLEL: Deploys stacks in all specified regions at the same time.

Separate multiple parameters with commas (,).

Note
  • You cannot specify MaxConcurrentCount and MaxConcurrentPercentage at the same time.

  • You cannot specify FailureToleranceCount and FailureTolerancePercentage at the same time.

{"FailureToleranceCount": 1, "MaxConcurrentCount": 2}

TimeoutInMinutes

integer

No

The timeout period for creating the stacks.

  • Default value: 60.

  • Unit: minutes.

10

DisableRollback

boolean

No

Indicates whether to disable rollback when a stack fails to be created.

Valid values:

  • true: Disables rollback.

  • false (default): Enables rollback.

false

ParameterOverrides

array<object>

No

A list of parameters that overwrite the template parameters.

object

No

ParameterKey

string

Yes

The name of the parameter to overwrite. If you do not specify this parameter, ROS uses the parameter name that was specified when the stack group was created.

You can specify up to 200 parameters.

Note
  • ParameterOverrides is optional.

  • If you specify ParameterOverrides, you must specify both ParameterOverrides.N.ParameterKey and ParameterOverrides.N.ParameterValue.

Amount

ParameterValue

string

Yes

The value of the parameter to overwrite. If you do not specify this parameter, ROS uses the parameter value that was specified when the stack group was created.

You can specify up to 200 parameters.

Note
  • ParameterOverrides is optional.

  • If you specify ParameterOverrides, you must specify both ParameterOverrides.N.ParameterKey and ParameterOverrides.N.ParameterValue.

1

DeploymentTargets

object

No

The deployment targets for deploying stacks in service-managed permission mode.

Note

You can specify only one of the AccountIds and DeploymentTargets parameters.

{"RdFolderId": "fd-4PvlVLOL8v"}

RdFolderIds

array

Yes

The IDs of the folders in the resource directory. You can specify up to 20 folder IDs.

You can create stacks in all the member accounts in the specified folders. If you select the root folder, stacks are created in all the member accounts in the resource directory.

Note

You can view the folder IDs on the Overview page in the Resource Management console. For more information, see View the basic information of a folder.

string

No

The IDs of the folders in the resource directory. You can specify up to 20 folder IDs.

You can create stacks in all the member accounts in the specified folders. If you select the root folder, stacks are created in all the member accounts in the resource directory.

Note

You can view the folder IDs on the Overview page in the Resource Management console. For more information, see View the basic information of a folder.

["fd-4PvlVLOL8v"]

AccountIds

array

No

The IDs of the member accounts in the resource directory. You can specify up to 30 member account IDs.

Note

You can view the member account IDs on the Overview page in the Resource Management console. For more information, see View the details of a member.

string

No

The IDs of the member accounts in the resource directory. You can specify up to 30 member account IDs.

Note

You can view the member account IDs on the Overview page in the Resource Management console. For more information, see View the details of a member.

["151266687691****","141261387191****"]

DeploymentOptions

array

No

The deployment options for deploying stacks in service-managed permission mode. You can specify up to one deployment option.

string

No

Valid value:

  • IgnoreExisting: Ignores the error that is reported if the stack instance that you want to create already exists.

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

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

14A07460-EBE7-47CA-9757-12CC4761D47A

OperationId

string

The ID of the operation.

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

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.