Skip to content

configure_health_check

configure_health_check(
    load_balancer_name: AccessPointName,
    health_check: HealthCheck,
    *,
    config_overrides: Optional[ElasticLoadBalancingClientConfig] = None,
) -> ConfigureHealthCheckOutput

Specifies the health check settings to use when evaluating the health state of your EC2 instances.

For more information, see Configure Health Checks for Your Load Balancer in the Classic Load Balancers Guide.

Parameters:

  • load_balancer_name (AccessPointName) –

    The name of the load balancer.

  • health_check (HealthCheck) –

    The configuration information.

Raises:

Examples:

To specify the health check settings for your backend EC2 instances This example specifies the health check settings used to evaluate the health of your backend EC2 instances.

>>> client.configure_health_check(load_balancer_name='my-load-balancer', health_check={'Target': 'HTTP:80/png', 'Interval': 30, 'Timeout': 3, 'UnhealthyThreshold': 2, 'HealthyThreshold': 2})
Source code in docs_src/capo_elastic_load_balancing/_services/elastic_load_balancing.py
def configure_health_check(
    self,
    load_balancer_name: "capo_elastic_load_balancing.types.access_point_name.AccessPointName",
    health_check: "capo_elastic_load_balancing.types.health_check.HealthCheck",
    *,
    config_overrides: Optional[ElasticLoadBalancingClientConfig] = None,
) -> "capo_elastic_load_balancing.types.configure_health_check_output.ConfigureHealthCheckOutput":
    """<p>Specifies the health check settings to use when evaluating the health state of your EC2 instances.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-healthchecks.html">Configure Health Checks for Your Load Balancer</a> in the <i>Classic Load Balancers Guide</i>.</p>

    Args:
        load_balancer_name: <p>The name of the load balancer.</p>
        health_check: <p>The configuration information.</p>

    Raises:
        capo_elastic_load_balancing.errors.access_point_not_found_exception.AccessPointNotFoundException: <p>The specified load balancer does not exist.</p>
        capo_elastic_load_balancing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To specify the health check settings for your backend EC2 instances
        This example specifies the health check settings used to evaluate the health of your backend EC2 instances.

        >>> client.configure_health_check(load_balancer_name='my-load-balancer', health_check={'Target': 'HTTP:80/png', 'Interval': 30, 'Timeout': 3, 'UnhealthyThreshold': 2, 'HealthyThreshold': 2})
    """

    def _handler(
        req: "OperationRequest[capo_elastic_load_balancing.types.configure_health_check_input.ConfigureHealthCheckInput]",
    ) -> OperationResponse[
        "capo_elastic_load_balancing.types.configure_health_check_output.ConfigureHealthCheckOutput"
    ]:
        import capo_elastic_load_balancing._operations.elastic_load_balancing_v7.configure_health_check

        output, http_response = (
            capo_elastic_load_balancing._operations.elastic_load_balancing_v7.configure_health_check.configure_health_check(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ConfigureHealthCheck")
    )
    input_: capo_elastic_load_balancing.types.configure_health_check_input.ConfigureHealthCheckInput = {
        "load_balancer_name": load_balancer_name,
        "health_check": health_check,
    }

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