Skip to content

list_instances async

list_instances(
    *,
    config_overrides: Optional[AsyncEMRClientConfig] = None,
    cluster_id: Optional[ClusterId] = None,
    instance_group_id: Optional[InstanceGroupId] = None,
    instance_group_types: Optional[InstanceGroupTypeList] = None,
    instance_fleet_id: Optional[InstanceFleetId] = None,
    instance_fleet_type: Optional[InstanceFleetType] = None,
    instance_states: Optional[InstanceStateList] = None,
    marker: Optional[Marker] = None,
) -> ListInstancesOutput

Provides information for all active Amazon EC2 instances and Amazon EC2 instances terminated in the last 30 days, up to a maximum of 2,000. Amazon EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.

Parameters:

  • cluster_id (Optional[ClusterId], default: None ) –

    The identifier of the cluster for which to list the instances.

  • instance_group_id (Optional[InstanceGroupId], default: None ) –

    The identifier of the instance group for which to list the instances.

  • instance_group_types (Optional[InstanceGroupTypeList], default: None ) –

    The type of instance group for which to list the instances.

  • instance_fleet_id (Optional[InstanceFleetId], default: None ) –

    The unique identifier of the instance fleet.

  • instance_fleet_type (Optional[InstanceFleetType], default: None ) –

    The node type of the instance fleet. For example MASTER, CORE, or TASK.

  • instance_states (Optional[InstanceStateList], default: None ) –

    A list of instance states that will filter the instances returned with this request.

  • marker (Optional[Marker], default: None ) –

    The pagination token that indicates the next set of results to retrieve.

Raises:

Source code in docs_src/capo_emr/_services/async_emr.py
async def list_instances(
    self,
    *,
    config_overrides: Optional[AsyncEMRClientConfig] = None,
    cluster_id: Optional["capo_emr.types.cluster_id.ClusterId"] = None,
    instance_group_id: Optional[
        "capo_emr.types.instance_group_id.InstanceGroupId"
    ] = None,
    instance_group_types: Optional[
        "capo_emr.types.instance_group_type_list.InstanceGroupTypeList"
    ] = None,
    instance_fleet_id: Optional[
        "capo_emr.types.instance_fleet_id.InstanceFleetId"
    ] = None,
    instance_fleet_type: Optional[
        "capo_emr.types.instance_fleet_type.InstanceFleetType"
    ] = None,
    instance_states: Optional[
        "capo_emr.types.instance_state_list.InstanceStateList"
    ] = None,
    marker: Optional["capo_emr.types.marker.Marker"] = None,
) -> "capo_emr.types.list_instances_output.ListInstancesOutput":
    """<p>Provides information for all active Amazon EC2 instances and Amazon EC2 instances terminated in the last 30 days, up to a maximum of 2,000. Amazon EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.</p>

    Args:
        cluster_id: <p>The identifier of the cluster for which to list the instances.</p>
        instance_group_id: <p>The identifier of the instance group for which to list the instances.</p>
        instance_group_types: <p>The type of instance group for which to list the instances.</p>
        instance_fleet_id: <p>The unique identifier of the instance fleet.</p>
        instance_fleet_type: <p>The node type of the instance fleet. For example MASTER, CORE, or TASK.</p>
        instance_states: <p>A list of instance states that will filter the instances returned with this request.</p>
        marker: <p>The pagination token that indicates the next set of results to retrieve.</p>

    Raises:
        capo_emr.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Amazon EMR service.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_emr.types.list_instances_input.ListInstancesInput]",
    ) -> AsyncOperationResponse[
        "capo_emr.types.list_instances_output.ListInstancesOutput"
    ]:
        import capo_emr._operations.elastic_map_reduce.list_instances

        (
            output,
            http_response,
        ) = await capo_emr._operations.elastic_map_reduce.list_instances.async_list_instances(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListInstances")
    )
    input_: capo_emr.types.list_instances_input.ListInstancesInput = {}
    if cluster_id is not None:
        input_["cluster_id"] = cluster_id
    if instance_group_id is not None:
        input_["instance_group_id"] = instance_group_id
    if instance_group_types is not None:
        input_["instance_group_types"] = instance_group_types
    if instance_fleet_id is not None:
        input_["instance_fleet_id"] = instance_fleet_id
    if instance_fleet_type is not None:
        input_["instance_fleet_type"] = instance_fleet_type
    if instance_states is not None:
        input_["instance_states"] = instance_states
    if marker is not None:
        input_["marker"] = marker

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output