Skip to content

list_stack_instances

list_stack_instances(
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[StackSetName] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[StackInstanceFilters] = None,
    stack_instance_account: Optional[Account] = None,
    stack_instance_region: Optional[Region] = None,
    call_as: Optional[CallAs] = None,
) -> ListStackInstancesOutput

Returns summary information about stack instances that are associated with the specified StackSet. You can filter for stack instances that are associated with a specific Amazon Web Services account name or Region, or that have a specific status.

Parameters:

  • stack_set_name (Optional[StackSetName], default: None ) –

    The name or unique ID of the StackSet that you want to list stack instances for.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a NextToken value that you can assign to the NextToken request parameter to get the next set of results.

  • filters (Optional[StackInstanceFilters], default: None ) –

    The filter to apply to stack instances

  • stack_instance_account (Optional[Account], default: None ) –

    The name of the Amazon Web Services account that you want to list stack instances for.

  • stack_instance_region (Optional[Region], default: None ) –

    The name of the Region where you want to list stack instances.

  • call_as (Optional[CallAs], default: None ) –

    [Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account.

    By default, SELF is specified. Use SELF for StackSets with self-managed permissions.

    • If you are signed in to the management account, specify SELF.

    • If you are signed in to a delegated administrator account, specify DELEGATED_ADMIN.

      Your Amazon Web Services account must be registered as a delegated administrator in the management account. For more information, see Register a delegated administrator in the CloudFormation User Guide.

Raises:

Source code in docs_src/capo_cloudformation/_services/cloud_formation.py
def list_stack_instances(
    self,
    *,
    config_overrides: Optional[CloudFormationClientConfig] = None,
    stack_set_name: Optional[
        "capo_cloudformation.types.stack_set_name.StackSetName"
    ] = None,
    next_token: Optional["capo_cloudformation.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_cloudformation.types.max_results.MaxResults"
    ] = None,
    filters: Optional[
        "capo_cloudformation.types.stack_instance_filters.StackInstanceFilters"
    ] = None,
    stack_instance_account: Optional[
        "capo_cloudformation.types.account.Account"
    ] = None,
    stack_instance_region: Optional[
        "capo_cloudformation.types.region.Region"
    ] = None,
    call_as: Optional["capo_cloudformation.types.call_as.CallAs"] = None,
) -> (
    "capo_cloudformation.types.list_stack_instances_output.ListStackInstancesOutput"
):
    """<p>Returns summary information about stack instances that are associated with the specified StackSet. You can filter for stack instances that are associated with a specific Amazon Web Services account name or Region, or that have a specific status.</p>

    Args:
        stack_set_name: <p>The name or unique ID of the StackSet that you want to list stack instances for.</p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        max_results: <p>The maximum number of results to be returned with a single call. If the number of available results exceeds this maximum, the response includes a <code>NextToken</code> value that you can assign to the <code>NextToken</code> request parameter to get the next set of results.</p>
        filters: <p>The filter to apply to stack instances</p>
        stack_instance_account: <p>The name of the Amazon Web Services account that you want to list stack instances for.</p>
        stack_instance_region: <p>The name of the Region where you want to list stack instances.</p>
        call_as: <p>[Service-managed permissions] Specifies whether you are acting as an account administrator in the organization's management account or as a delegated administrator in a member account.</p> <p>By default, <code>SELF</code> is specified. Use <code>SELF</code> for StackSets with self-managed permissions.</p> <ul> <li> <p>If you are signed in to the management account, specify <code>SELF</code>.</p> </li> <li> <p>If you are signed in to a delegated administrator account, specify <code>DELEGATED_ADMIN</code>.</p> <p>Your Amazon Web Services account must be registered as a delegated administrator in the management account. For more information, see <a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-orgs-delegated-admin.html">Register a delegated administrator</a> in the <i>CloudFormation User Guide</i>.</p> </li> </ul>

    Raises:
        capo_cloudformation.errors.stack_set_not_found_exception.StackSetNotFoundException: <p>The specified StackSet doesn't exist.</p>
        capo_cloudformation.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudformation.types.list_stack_instances_input.ListStackInstancesInput]",
    ) -> OperationResponse[
        "capo_cloudformation.types.list_stack_instances_output.ListStackInstancesOutput"
    ]:
        import capo_cloudformation._operations.cloud_formation.list_stack_instances

        output, http_response = (
            capo_cloudformation._operations.cloud_formation.list_stack_instances.list_stack_instances(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListStackInstances")
    )
    input_: capo_cloudformation.types.list_stack_instances_input.ListStackInstancesInput = {}
    if stack_set_name is not None:
        input_["stack_set_name"] = stack_set_name
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters
    if stack_instance_account is not None:
        input_["stack_instance_account"] = stack_instance_account
    if stack_instance_region is not None:
        input_["stack_instance_region"] = stack_instance_region
    if call_as is not None:
        input_["call_as"] = call_as

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output