Updates stacks for specified accounts in specified regions.

This topic provides an example on how to update stacks in a stack group. In this example, the stacks that are deployed in a stack group named MyStackGroup are updated. The stacks are deployed 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 deployed 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 UpdateStackInstances

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

RegionId String Yes cn-hangzhou

The ID of the region to which the stack group belongs. 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 in a region.

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

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

The IDs of the accounts within which the self-managed permission model is used to deploy stacks. You can specify up to 20 account IDs.

Note This parameter is required if you use the self-managed permission model to update the stacks.
RegionIds Array of String Yes ["cn-hangzhou","cn-beijing"]

The IDs of the regions in which you want to update the stacks. You can specify up to 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 the value 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 Update stack instances in hangzhou and beijing

The description of the operation that you want to perform to update the stacks.

The description must be 1 to 256 characters in length.

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

The custom preferences on how Resource Orchestration Service (ROS) updates the stacks.

The following parameters are included:

  • {"FailureToleranceCount": N}

    The number of accounts within which stack operation failures can occur in each region. If the value of this parameter is exceeded in a region, ROS stops the operation in the region. If the operation is stopped in one region, the operation is no longer performed 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 number of accounts within which stack operation failures can occur to the total number of accounts in each region. If the value of this parameter is exceeded in a region, 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 value down to the nearest integer.

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

  • {"MaxConcurrentCount": N}

    The maximum number of accounts within which stacks are deployed at the same time 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 maximum number of accounts within which stacks are deployed at the same time to the total number of accounts in each region.

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

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

  • {"RegionConcurrencyType": N}

    The mode that you want to use to deploy stacks across regions. Default value: SEQUENTIAL. Valid values:

    • SEQUENTIAL: deploys stacks in each specified region based on the specified sequence of regions. ROS deploys stacks in one region at a time.
    • PARALLEL: deploys stacks in parallel in all specified regions.

Separate multiple parameters with commas (,).

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

The timeout period for the update operation on the stack.

  • Default value: 60.
  • Unit: minutes.
ParameterOverrides.N.ParameterKey String Yes Amount

The name of parameter N that you want to use to override a specific parameter. If you do not specify the name of parameter N, ROS uses the name that you specify when you create the stack group.

Maximum value of N: 200.

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

The value of parameter N that you want to use to override a specific parameter. If you do not specify the name and value of parameter N, ROS uses the name and value that you specify when you create the stack group.

Maximum value of N: 200.

Note
  • The ParameterOverrides parameter is optional.
  • If you specify the ParameterOverrides parameter, you must specify the ParameterOverrides.N.ParameterKey and ParameterOverrides.N.ParameterValue parameters.
DeploymentTargets Object No

The folders in which the service-managed permission model is used to deploy stacks.

Note This parameter is required if you use the service-managed permission model to update the stacks.
RdFolderIds Array of String No ["fd-4PvlVLOL8v"]

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

You must specify at least one of the RdFolderIds and AccountIds parameters. The parameters are subject to the following rules:

  • If you specify only the RdFolderIds parameter, stacks are deployed within all members in the specified folders. If you select the Root folder, stacks are deployed within all members in the resource directory.
  • If you specify only the AccountIds parameter, stacks are deployed within the specified members.
  • If you specify both parameters, the accounts specified by using the AccountIds parameter must be contained in the folders specified by using the RdFolderIds parameter. In this case, stacks are deployed within the specified members that are contained in the specified folders.
Note To view the folder IDs, go to the Overview page in the Resource Management console. For more information, see View the basic information of a folder.
AccountIds Array of String No ["151266687691****","141261387191****"]

The IDs of the members in the resource directory. You can specify up to 20 member IDs.

Note To view the member IDs, go to the Overview page in the Resource Management console. For more information, see View the detailed information of a member.

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=UpdateStackInstances
&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

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

JSON format

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

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

Error codes

For a list of error codes, see Service error codes.

Error code

Error message

HTTP status code

Description

InvalidParameter

The specified parameter {name} is invalid, {reason}.

400

The error message returned because the parameter is invalid. name indicates the parameter name. reason indicates the cause of the error.

StackGroupNotFound

The StackGroup ({name}) could not be found.

404

The error message returned because the stack group does not exist. name indicates the name of the stack group.

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.