java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.elasticloadbalancingv2.targets.LambdaTarget
All Implemented Interfaces:
IApplicationLoadBalancerTarget, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:01.763Z") @Stability(Stable) public class LambdaTarget extends software.amazon.jsii.JsiiObject implements IApplicationLoadBalancerTarget
Example:

 import software.amazon.awscdk.services.lambda.*;
 import software.amazon.awscdk.services.elasticloadbalancingv2.targets.*;
 Function lambdaFunction;
 ApplicationLoadBalancer lb;
 ApplicationListener listener = lb.addListener("Listener", BaseApplicationListenerProps.builder().port(80).build());
 listener.addTargets("Targets", AddApplicationTargetsProps.builder()
         .targets(List.of(new LambdaTarget(lambdaFunction)))
         // For Lambda Targets, you need to explicitly enable health checks if you
         // want them.
         .healthCheck(HealthCheck.builder()
                 .enabled(true)
                 .build())
         .build());
 
  • Constructor Details

    • LambdaTarget

      protected LambdaTarget(software.amazon.jsii.JsiiObjectRef objRef)
    • LambdaTarget

      protected LambdaTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • LambdaTarget

      @Stability(Stable) public LambdaTarget(@NotNull IFunction fn)
      Create a new Lambda target.

      Parameters:
      fn - This parameter is required.
  • Method Details

    • attachToApplicationTargetGroup

      @Stability(Stable) @NotNull public LoadBalancerTargetProps attachToApplicationTargetGroup(@NotNull IApplicationTargetGroup targetGroup)
      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.

      Specified by:
      attachToApplicationTargetGroup in interface IApplicationLoadBalancerTarget
      Parameters:
      targetGroup - This parameter is required.
    • attachToNetworkTargetGroup

      @Stability(Stable) @NotNull public LoadBalancerTargetProps attachToNetworkTargetGroup(@NotNull INetworkTargetGroup targetGroup)
      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:
      targetGroup - This parameter is required.