class LambdaTarget
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets.LambdaTarget |
Java | software.amazon.awscdk.services.elasticloadbalancingv2.targets.LambdaTarget |
Python | aws_cdk.aws_elasticloadbalancingv2_targets.LambdaTarget |
TypeScript (source) | @aws-cdk/aws-elasticloadbalancingv2-targets » LambdaTarget |
Implements
IApplication
Example
import * as lambda from '@aws-cdk/aws-lambda';
import * as targets from '@aws-cdk/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
new LambdaTarget(fn: IFunction)
Parameters
- fn
IFunction
Create a new Lambda target.
Methods
Name | Description |
---|---|
attach | Register this instance target with a load balancer. |
attach | Register this instance target with a load balancer. |
ToApplicationTargetGroup(targetGroup)
attachpublic attachToApplicationTargetGroup(targetGroup: IApplicationTargetGroup): LoadBalancerTargetProps
Parameters
- targetGroup
IApplication
Target Group
Returns
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.
ToNetworkTargetGroup(targetGroup)
attachpublic attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetProps
Parameters
- targetGroup
INetwork
Target Group
Returns
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.