Skip to content

modify_target_group

modify_target_group(
    *,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    target_group_arn: Optional[TargetGroupArn] = None,
    health_check_protocol: Optional[ProtocolEnum] = None,
    health_check_port: Optional[HealthCheckPort] = None,
    health_check_path: Optional[Path] = None,
    health_check_enabled: Optional[HealthCheckEnabled] = None,
    health_check_interval_seconds: Optional[HealthCheckIntervalSeconds] = None,
    health_check_timeout_seconds: Optional[HealthCheckTimeoutSeconds] = None,
    healthy_threshold_count: Optional[HealthCheckThresholdCount] = None,
    unhealthy_threshold_count: Optional[HealthCheckThresholdCount] = None,
    matcher: Optional[Matcher] = None,
) -> ModifyTargetGroupOutput

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

Parameters:

  • target_group_arn (Optional[TargetGroupArn], default: None ) –

    The Amazon Resource Name (ARN) of the target group.

  • health_check_protocol (Optional[ProtocolEnum], default: None ) –

    The protocol the load balancer uses when performing health checks on targets. For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. It is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The GENEVE, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC protocols are not supported for health checks.

  • health_check_port (Optional[HealthCheckPort], default: None ) –

    The port the load balancer uses when performing health checks on targets.

  • health_check_path (Optional[Path], default: None ) –

    [HTTP/HTTPS health checks] The destination for health checks on the targets.

    [HTTP1 or HTTP2 protocol version] The ping path. The default is /.

    [GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is /Amazon Web Services.ALB/healthcheck.

  • health_check_enabled (Optional[HealthCheckEnabled], default: None ) –

    Indicates whether health checks are enabled. If the target type is lambda, health checks are disabled by default but can be enabled. If the target type is instance, ip, or alb, health checks are always enabled and can't be disabled.

  • health_check_interval_seconds (Optional[HealthCheckIntervalSeconds], default: None ) –

    The approximate amount of time, in seconds, between health checks of an individual target.

  • health_check_timeout_seconds (Optional[HealthCheckTimeoutSeconds], default: None ) –

    [HTTP/HTTPS health checks] The amount of time, in seconds, during which no response means a failed health check.

  • healthy_threshold_count (Optional[HealthCheckThresholdCount], default: None ) –

    The number of consecutive health checks successes required before considering an unhealthy target healthy.

  • unhealthy_threshold_count (Optional[HealthCheckThresholdCount], default: None ) –

    The number of consecutive health check failures required before considering the target unhealthy.

  • matcher (Optional[Matcher], default: None ) –

    [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target. For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.

Raises:

Examples:

To modify the health check configuration for a target group This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.

>>> client.modify_target_group(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f', health_check_protocol='HTTPS', health_check_port='443')
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
def modify_target_group(
    self,
    *,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    target_group_arn: Optional[
        "capo_elastic_load_balancing_v2.types.target_group_arn.TargetGroupArn"
    ] = None,
    health_check_protocol: Optional[
        "capo_elastic_load_balancing_v2.types.protocol_enum.ProtocolEnum"
    ] = None,
    health_check_port: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_port.HealthCheckPort"
    ] = None,
    health_check_path: Optional[
        "capo_elastic_load_balancing_v2.types.path.Path"
    ] = None,
    health_check_enabled: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_enabled.HealthCheckEnabled"
    ] = None,
    health_check_interval_seconds: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_interval_seconds.HealthCheckIntervalSeconds"
    ] = None,
    health_check_timeout_seconds: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_timeout_seconds.HealthCheckTimeoutSeconds"
    ] = None,
    healthy_threshold_count: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_threshold_count.HealthCheckThresholdCount"
    ] = None,
    unhealthy_threshold_count: Optional[
        "capo_elastic_load_balancing_v2.types.health_check_threshold_count.HealthCheckThresholdCount"
    ] = None,
    matcher: Optional[
        "capo_elastic_load_balancing_v2.types.matcher.Matcher"
    ] = None,
) -> "capo_elastic_load_balancing_v2.types.modify_target_group_output.ModifyTargetGroupOutput":
    """<p>Modifies the health checks used when evaluating the health state of the targets in the specified target group.</p>

    Args:
        target_group_arn: <p>The Amazon Resource Name (ARN) of the target group.</p>
        health_check_protocol: <p>The protocol the load balancer uses when performing health checks on targets. For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. It is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The GENEVE, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC protocols are not supported for health checks.</p>
        health_check_port: <p>The port the load balancer uses when performing health checks on targets.</p>
        health_check_path: <p>[HTTP/HTTPS health checks] The destination for health checks on the targets.</p> <p>[HTTP1 or HTTP2 protocol version] The ping path. The default is /.</p> <p>[GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is /Amazon Web Services.ALB/healthcheck.</p>
        health_check_enabled: <p>Indicates whether health checks are enabled. If the target type is <code>lambda</code>, health checks are disabled by default but can be enabled. If the target type is <code>instance</code>, <code>ip</code>, or <code>alb</code>, health checks are always enabled and can't be disabled.</p>
        health_check_interval_seconds: <p>The approximate amount of time, in seconds, between health checks of an individual target.</p>
        health_check_timeout_seconds: <p>[HTTP/HTTPS health checks] The amount of time, in seconds, during which no response means a failed health check.</p>
        healthy_threshold_count: <p>The number of consecutive health checks successes required before considering an unhealthy target healthy.</p>
        unhealthy_threshold_count: <p>The number of consecutive health check failures required before considering the target unhealthy.</p>
        matcher: <p>[HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target. For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.</p>

    Raises:
        capo_elastic_load_balancing_v2.errors.invalid_configuration_request_exception.InvalidConfigurationRequestException: <p>The requested configuration is not valid.</p>
        capo_elastic_load_balancing_v2.errors.target_group_not_found_exception.TargetGroupNotFoundException: <p>The specified target group does not exist.</p>
        capo_elastic_load_balancing_v2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To modify the health check configuration for a target group
        This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.

        >>> client.modify_target_group(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-https-targets/2453ed029918f21f', health_check_protocol='HTTPS', health_check_port='443')
    """

    def _handler(
        req: "OperationRequest[capo_elastic_load_balancing_v2.types.modify_target_group_input.ModifyTargetGroupInput]",
    ) -> OperationResponse[
        "capo_elastic_load_balancing_v2.types.modify_target_group_output.ModifyTargetGroupOutput"
    ]:
        import capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.modify_target_group

        output, http_response = (
            capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.modify_target_group.modify_target_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyTargetGroup")
    )
    input_: capo_elastic_load_balancing_v2.types.modify_target_group_input.ModifyTargetGroupInput = {}
    if target_group_arn is not None:
        input_["target_group_arn"] = target_group_arn
    if health_check_protocol is not None:
        input_["health_check_protocol"] = health_check_protocol
    if health_check_port is not None:
        input_["health_check_port"] = health_check_port
    if health_check_path is not None:
        input_["health_check_path"] = health_check_path
    if health_check_enabled is not None:
        input_["health_check_enabled"] = health_check_enabled
    if health_check_interval_seconds is not None:
        input_["health_check_interval_seconds"] = health_check_interval_seconds
    if health_check_timeout_seconds is not None:
        input_["health_check_timeout_seconds"] = health_check_timeout_seconds
    if healthy_threshold_count is not None:
        input_["healthy_threshold_count"] = healthy_threshold_count
    if unhealthy_threshold_count is not None:
        input_["unhealthy_threshold_count"] = unhealthy_threshold_count
    if matcher is not None:
        input_["matcher"] = matcher

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