# LambdaTarget

Extends: LambdaTarget
Implements: IApplicationLoadBalancerTarget

- Source: [`aws-elasticloadbalancingv2-targets/lib/lambda-target.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-elasticloadbalancingv2-targets/lib/lambda-target.ts#L5)

## Example

```ts
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as targets from 'aws-cdk-lib/aws-elasticloadbalancingv2-targets';

declare const lambdaFunction: lambda.Function;
declare const lb: elbv2.ApplicationLoadBalancer;

const listener = lb.addListener('Listener', { port: 80 });
listener.addTargets('Targets', {
  targets: [new targets.LambdaTarget(lambdaFunction)],

  // For Lambda Targets, you need to explicitly enable health checks if you
  // want them.
  healthCheck: {
    enabled: true,
  }
});
```

## Initializer

```ts
new LambdaTarget(fn: IFunction)
```

## Methods

- `attachToApplicationTargetGroup(targetGroup: IApplicationTargetGroup): LoadBalancerTargetProps` — 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.

- `attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetProps` — 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.
