Queries the stacks that are deployed in a stack group.

In this example, the stacks that are deployed in 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 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 within 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.

StackInstanceAccountId String No 156552876021****

The ID of the account to which the stack belongs.

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

The ID of the region to which the stack belongs.

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 total number of stacks.

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

Details of the stacks.

Status String CURRENT

The state of the stack.

Valid values:

  • CURRENT: The stack is up to date with the stack group.
  • OUTDATED: The stack is not up to date with the stack group. Stacks are in the OUTDATED state due to the following possible reasons:
    • When the CreateStackInstances operation is called to create stacks, the stacks fail to be created.
    • When the UpdateStackInstances or UpdateStackGroup operation is called to update stacks, the stacks fail to be updated, or only specific stacks 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.

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

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

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

The state of the stack when the last successful drift detection was performed on the stack group.

Valid values:

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

The reason why the stack is in the OUTDATED state.

Note This parameter is returned only if the stack 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 belongs.

RegionId String cn-beijing

The ID of the region to which the stack belongs.

RdFolderId String fd-4PvlVLOL8v

The ID of the folder in the resource directory.

Note This parameter is returned only if 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, 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 name of the parameter. 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.