Skip to content

describe_instances_health async

describe_instances_health(
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    environment_name: Optional[EnvironmentName] = None,
    environment_id: Optional[EnvironmentId] = None,
    attribute_names: Optional[InstancesHealthAttributes] = None,
    next_token: Optional[NextToken] = None,
) -> DescribeInstancesHealthResult

Retrieves detailed information about the health of instances in your Elastic Beanstalk environments. This operation requires enhanced health reporting.

This action only returns information about environments that the calling principle has IAM permissions to access. For example, consider a case where a user only has permission to access one of three environments. When the user calls this action, the response will only include the one environment that the user has permission to access instead of all three environments. If the user doesn’t have access to any of the environments an empty result is returned.

The AWSElasticBeanstalkReadOnly managed policy allows operators to view information about resources related to Elastic Beanstalk environments. For more information, see Managing Elastic Beanstalk user policies in the Elastic Beanstalk Developer Guide. For detailed instructions to attach a policy to a user or group, see the section Controlling access with managed policies in the same topic.

Parameters:

  • environment_name (Optional[EnvironmentName], default: None ) –

    Specify the Elastic Beanstalk environment by name.

  • environment_id (Optional[EnvironmentId], default: None ) –

    Specify the Elastic Beanstalk environment by ID.

  • attribute_names (Optional[InstancesHealthAttributes], default: None ) –

    Specifies the response elements you wish to receive. To retrieve all attributes, set to All. If no attribute names are specified, returns a list of instances.

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

    Specify the pagination token returned by a previous call.

Raises:

Examples:

To view environment health The following operation retrieves health information for instances in an environment named my-env:

>>> await client.describe_instances_health(environment_name='my-env', attribute_names=['All'])
Source code in docs_src/capo_elastic_beanstalk/_services/async_elastic_beanstalk.py
async def describe_instances_health(
    self,
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    environment_name: Optional[
        "capo_elastic_beanstalk.types.environment_name.EnvironmentName"
    ] = None,
    environment_id: Optional[
        "capo_elastic_beanstalk.types.environment_id.EnvironmentId"
    ] = None,
    attribute_names: Optional[
        "capo_elastic_beanstalk.types.instances_health_attributes.InstancesHealthAttributes"
    ] = None,
    next_token: Optional[
        "capo_elastic_beanstalk.types.next_token.NextToken"
    ] = None,
) -> "capo_elastic_beanstalk.types.describe_instances_health_result.DescribeInstancesHealthResult":
    """<p>Retrieves detailed information about the health of instances in your Elastic Beanstalk environments. This operation requires <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/health-enhanced.html">enhanced health reporting</a>.</p> <p>This action only returns information about environments that the calling principle has IAM permissions to access. For example, consider a case where a user only has permission to access one of three environments. When the user calls this action, the response will only include the one environment that the user has permission to access instead of all three environments. If the user doesn’t have access to any of the environments an empty result is returned.</p> <note> <p>The <a href="https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSElasticBeanstalkReadOnly.html">AWSElasticBeanstalkReadOnly</a> managed policy allows operators to view information about resources related to Elastic Beanstalk environments. For more information, see <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.iam.managed-policies.html"> Managing Elastic Beanstalk user policies</a> in the <i>Elastic Beanstalk Developer Guide</i>. For detailed instructions to attach a policy to a user or group, see the section <a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.iam.managed-policies.html#iam-userpolicies-managed"> Controlling access with managed policies</a> in the same topic.</p> </note>

    Args:
        environment_name: <p>Specify the Elastic Beanstalk environment by name.</p>
        environment_id: <p>Specify the Elastic Beanstalk environment by ID.</p>
        attribute_names: <p>Specifies the response elements you wish to receive. To retrieve all attributes, set to <code>All</code>. If no attribute names are specified, returns a list of instances.</p>
        next_token: <p>Specify the pagination token returned by a previous call.</p>

    Raises:
        capo_elastic_beanstalk.errors.elastic_beanstalk_service_exception.ElasticBeanstalkServiceException: <p>A generic service exception has occurred.</p>
        capo_elastic_beanstalk.errors.invalid_request_exception.InvalidRequestException: <p>One or more input parameters is not valid. Please correct the input parameters and try the operation again.</p>
        capo_elastic_beanstalk.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To view environment health
        The following operation retrieves health information for instances in an environment named my-env:

        >>> await client.describe_instances_health(environment_name='my-env', attribute_names=['All'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elastic_beanstalk.types.describe_instances_health_request.DescribeInstancesHealthRequest]",
    ) -> AsyncOperationResponse[
        "capo_elastic_beanstalk.types.describe_instances_health_result.DescribeInstancesHealthResult"
    ]:
        import capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.describe_instances_health

        (
            output,
            http_response,
        ) = await capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.describe_instances_health.async_describe_instances_health(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeInstancesHealth")
    )
    input_: capo_elastic_beanstalk.types.describe_instances_health_request.DescribeInstancesHealthRequest = {}
    if environment_name is not None:
        input_["environment_name"] = environment_name
    if environment_id is not None:
        input_["environment_id"] = environment_id
    if attribute_names is not None:
        input_["attribute_names"] = attribute_names
    if next_token is not None:
        input_["next_token"] = next_token

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