Class AlbTarget
A single Application Load Balancer as the target for load balancing.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets
Assembly: Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets.dll
Syntax (csharp)
public class AlbTarget : AlbArnTarget, INetworkLoadBalancerTarget
Syntax (vb)
Public Class AlbTarget
Inherits AlbArnTarget
Implements INetworkLoadBalancerTarget
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.ElasticLoadBalancingV2.Targets;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.ECS.Patterns;
Vpc vpc;
var task = new FargateTaskDefinition(this, "Task", new FargateTaskDefinitionProps { Cpu = 256, MemoryLimitMiB = 512 });
task.AddContainer("nginx", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("public.ecr.aws/nginx/nginx:latest"),
PortMappings = new [] { new PortMapping { ContainerPort = 80 } }
});
var svc = new ApplicationLoadBalancedFargateService(this, "Service", new ApplicationLoadBalancedFargateServiceProps {
Vpc = vpc,
TaskDefinition = task,
PublicLoadBalancer = false
});
var nlb = new NetworkLoadBalancer(this, "Nlb", new NetworkLoadBalancerProps {
Vpc = vpc,
CrossZoneEnabled = true,
InternetFacing = true
});
var listener = nlb.AddListener("listener", new BaseNetworkListenerProps { Port = 80 });
listener.AddTargets("Targets", new AddNetworkTargetsProps {
Targets = new [] { new AlbTarget(svc.LoadBalancer, 80) },
Port = 80
});
new CfnOutput(this, "NlbEndpoint", new CfnOutputProps { Value = $"http://{nlb.loadBalancerDnsName}" });
Synopsis
Constructors
AlbTarget(ApplicationLoadBalancer, Double) | |
AlbTarget(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
AlbTarget(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Constructors
AlbTarget(ApplicationLoadBalancer, Double)
public AlbTarget(ApplicationLoadBalancer alb, double port)
Parameters
- alb ApplicationLoadBalancer
The application load balancer to load balance to.
- port System.Double
The port on which the target is listening.
AlbTarget(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected AlbTarget(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
AlbTarget(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected AlbTarget(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props