AlbTarget
Class Deprecated
Deprecated: Use AlbListenerTarget instead or AlbArnTarget for an imported load balancer. This target does not automatically add a dependency between the ALB listener and resulting NLB target group, without which may cause stack deployments to fail if the NLB target group is provisioned before the listener has been fully created.
A single Application Load Balancer as the target for load balancing.
| Source | aws-elasticloadbalancingv2-targets/lib/alb-target.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_elasticloadbalancingv2 as elbv2 } from 'aws-cdk-lib';
import { aws_elasticloadbalancingv2_targets as elasticloadbalancingv2_targets } from 'aws-cdk-lib';
declare const applicationLoadBalancerRef: elbv2.IApplicationLoadBalancerRef;
const albTarget = new elasticloadbalancingv2_targets.AlbTarget(applicationLoadBalancerRef, 123);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_elasticloadbalancingv2 as elbv2
from aws_cdk import aws_elasticloadbalancingv2_targets as elasticloadbalancingv2_targets
# application_load_balancer_ref: elbv2.IApplicationLoadBalancerRef
alb_target = elasticloadbalancingv2_targets.AlbTarget(application_load_balancer_ref, 123)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.elasticloadbalancingv2.*;
import software.amazon.awscdk.services.elasticloadbalancingv2.targets.*;
IApplicationLoadBalancerRef applicationLoadBalancerRef;
AlbTarget albTarget = new AlbTarget(applicationLoadBalancerRef, 123);
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ElasticLoadBalancingV2;
using Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets;
IApplicationLoadBalancerRef applicationLoadBalancerRef;
var albTarget = new AlbTarget(applicationLoadBalancerRef, 123);
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var applicationLoadBalancerRef IApplicationLoadBalancerRef
albTarget := awscdk.Aws_elasticloadbalancingv2_targets.NewAlbTarget(applicationLoadBalancerRef, jsii.Number(123))
Initializer
ts
new AlbTarget(alb: IApplicationLoadBalancerRef, port: number)
python
AlbTarget(alb: IApplicationLoadBalancerRef, port: int | float)
java
new AlbTarget(IApplicationLoadBalancerRef alb, Number port)
csharp
new AlbTarget(IApplicationLoadBalancerRef alb, double port)
go
NewAlbTarget(Alb IApplicationLoadBalancerRef, Port *float64)
Methods
attachToNetworkTargetGroup(targetGroup: INetworkTargetGroup): LoadBalancerTargetPropsdef attach_to_network_target_group(self, target_group: INetworkTargetGroup) -> LoadBalancerTargetPropspublic LoadBalancerTargetProps attachToNetworkTargetGroup(INetworkTargetGroup targetGroup)public LoadBalancerTargetProps AttachToNetworkTargetGroup(INetworkTargetGroup targetGroup)func AttachToNetworkTargetGroup(TargetGroup INetworkTargetGroup) LoadBalancerTargetProps #Register this alb target with a load balancer.
Don't call this, it is called automatically when you add the target to a load balancer.