LambdaTarget

class aws_cdk.aws_elasticloadbalancingv2_targets.LambdaTarget(fn)

Bases: object

ExampleMetadata:

infused

Example:

import aws_cdk.aws_lambda as lambda_
import aws_cdk.aws_elasticloadbalancingv2_targets as targets

# lambda_function: lambda.Function
# lb: elbv2.ApplicationLoadBalancer


listener = lb.add_listener("Listener", port=80)
listener.add_targets("Targets",
    targets=[targets.LambdaTarget(lambda_function)],

    # For Lambda Targets, you need to explicitly enable health checks if you
    # want them.
    health_check=elbv2.HealthCheck(
        enabled=True
    )
)

Create a new Lambda target.

Parameters:

fn (IFunction) –

Methods

attach_to_application_target_group(target_group)

Register this instance target with a load balancer.

Don’t call this, it is called automatically when you add the target to a load balancer.

Parameters:

target_group (IApplicationTargetGroup) –

Return type:

LoadBalancerTargetProps

attach_to_network_target_group(target_group)

Register this instance target with a load balancer.

Don’t call this, it is called automatically when you add the target to a load balancer.

Parameters:

target_group (INetworkTargetGroup) –

Return type:

LoadBalancerTargetProps