Queries the stack instances that are associated with a stack group.

In this example, the stack instances that are associated with a stack group named MyStackGroup are queried. 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 ListStackInstances

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

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.

StackInstanceAccountId String No 156552876021****

The ID of the account to which the stack instance belongs.

  • If the stack group is granted self-managed permissions, the stack instance belongs to an Alibaba Cloud account.
  • If the stack group is granted service-managed permissions, the stack instance belongs to a member account in the resource directory.
    Note For more information about the account, see Overview.
StackInstanceRegionId String No cn-beijing

The region ID of the stack instance.

PageSize Long No 10

The number of entries to return on each page.

  • Valid values: 1 to 50.
  • Default value: 10.
PageNumber Long No 1

The number of the page to return.

  • Pages start from page 1.
  • Default value: 1.

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

Response parameters

Parameter Type Example Description
TotalCount Integer 1

The number of stack instances.

RequestId String 85DE34BD-7FF9-480F-8C21-556E9DA93ACD

The ID of the request.

PageSize Integer 1

The number of entries returned per page.

PageNumber Integer 1

The page number of the returned page.

StackInstances Array of StackInstance

The details of the stack instances.

Status String CURRENT

The status of the stack instance.

Valid values:

  • CURRENT: The stack that corresponds to the stack instance is up to date in the stack group.
  • OUTDATED: The stack that corresponds to the stack instance is not up to date in the stack group. Stack instances are in the OUTDATED state due to the following possible reasons:
    • When the CreateStackInstances operation is called to create stack instances, the relevant stacks fail to be created.
    • When the UpdateStackInstances or UpdateStackGroup operation is called to update stack instances, the relevant stacks fail to be updated, or only some stack instances are updated.
    • The creation or update operation is not completed.
StackGroupId String fd0ddef9-9540-4b42-a464-94f77835****

The ID of the stack group.

StackId String 35ad60e3-6a92-42d8-8812-f0700d45****

The ID of the stack that corresponds to the stack instance.

Note This parameter is returned only when the stack instance is in the CURRENT state.
DriftDetectionTime String 2020-02-27T07:47:47

The time when the last drift detection was performed on the stack.

Note This parameter is returned only when the drift detection is performed on the stack group.
StackDriftStatus String IN_SYNC

The drift status of the stack on which the last drift detection was performed.

Valid values:

  • DRIFTED: The stack has drifted.
  • NOT_CHECKED: No drift detection is completed on the stack.
  • IN_SYNC: The stack is being synchronized.
Note This parameter is returned only when the drift detection is performed on the stack group.
StatusReason String User initiated stop

The reason why the operation is in a specific state.

Note This parameter is returned only when the stack instance is in the OUTDATED state.
StackGroupName String MyStackGroup

The name of the stack group.

AccountId String 156552876021****

The ID of the account to which the stack instance belongs.

RegionId String cn-beijing

The region ID of the stack instance.

RdFolderId String fd-4PvlVLOL8v

The folder ID of the resource directory.

Note This parameter is returned only when the stack group is granted service-managed permissions.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=ListStackInstances
&RegionId=cn-hangzhou
&StackGroupName=MyStackGroup
&<Common request parameters>

Sample success responses

XML format

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

<ListStackInstancesResponse>
    <TotalCount>1</TotalCount>
    <RequestId>85DE34BD-7FF9-480F-8C21-556E9DA93ACD</RequestId>
    <PageSize>10</PageSize>
    <PageNumber>1</PageNumber>
    <StackInstances>
        <Status>OUTDATED</Status>
        <AccountId>156552876021****</AccountId>
        <StatusReason>User initiated stop.</StatusReason>
        <StackGroupName>MyStackGroup</StackGroupName>
        <StackGroupId>fd0ddef9-9540-4b42-a464-94f77835****</StackGroupId>
        <RegionId>cn-beijing</RegionId>
    </StackInstances>
</ListStackInstancesResponse>

JSON format

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

{
  "TotalCount" : 1,
  "RequestId" : "85DE34BD-7FF9-480F-8C21-556E9DA93ACD",
  "PageSize" : 10,
  "PageNumber" : 1,
  "StackInstances" : [ {
    "Status" : "OUTDATED",
    "AccountId" : "156552876021****",
    "StatusReason" : "User initiated stop.",
    "StackGroupName" : "MyStackGroup",
    "StackGroupId" : "fd0ddef9-9540-4b42-a464-94f77835****",
    "RegionId" : "cn-beijing"
  } ]
}

Error codes

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

Error code

Error message

HTTP status code

Description

InvalidParameter

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

400

The error message returned because the specified parameter is invalid. name indicates the parameter name. reason indicates the reason for the error.

StackGroupNotFound

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

404

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