Class AlbTarget
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.elasticloadbalancingv2.targets.AlbArnTarget
software.amazon.awscdk.services.elasticloadbalancingv2.targets.AlbTarget
- All Implemented Interfaces:
INetworkLoadBalancerTarget
,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:49.672Z")
@Stability(Stable)
public class AlbTarget
extends AlbArnTarget
A single Application Load Balancer as the target for load balancing.
Example:
import software.amazon.awscdk.services.elasticloadbalancingv2.targets.*; import software.amazon.awscdk.services.ecs.*; import software.amazon.awscdk.services.ecs.patterns.*; Vpc vpc; FargateTaskDefinition task = FargateTaskDefinition.Builder.create(this, "Task").cpu(256).memoryLimitMiB(512).build(); task.addContainer("nginx", ContainerDefinitionOptions.builder() .image(ContainerImage.fromRegistry("public.ecr.aws/nginx/nginx:latest")) .portMappings(List.of(PortMapping.builder().containerPort(80).build())) .build()); ApplicationLoadBalancedFargateService svc = ApplicationLoadBalancedFargateService.Builder.create(this, "Service") .vpc(vpc) .taskDefinition(task) .publicLoadBalancer(false) .build(); NetworkLoadBalancer nlb = NetworkLoadBalancer.Builder.create(this, "Nlb") .vpc(vpc) .crossZoneEnabled(true) .internetFacing(true) .build(); NetworkListener listener = nlb.addListener("listener", BaseNetworkListenerProps.builder().port(80).build()); listener.addTargets("Targets", AddNetworkTargetsProps.builder() .targets(List.of(new AlbTarget(svc.getLoadBalancer(), 80))) .port(80) .build()); CfnOutput.Builder.create(this, "NlbEndpoint").value(String.format("http://%s", nlb.getLoadBalancerDnsName())).build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkLoadBalancerTarget
INetworkLoadBalancerTarget.Jsii$Default, INetworkLoadBalancerTarget.Jsii$Proxy
-
Constructor Summary
ModifierConstructorDescriptionAlbTarget
(ApplicationLoadBalancer alb, Number port) protected
AlbTarget
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
AlbTarget
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Methods inherited from class software.amazon.awscdk.services.elasticloadbalancingv2.targets.AlbArnTarget
attachToNetworkTargetGroup
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
AlbTarget
protected AlbTarget(software.amazon.jsii.JsiiObjectRef objRef) -
AlbTarget
protected AlbTarget(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
AlbTarget
- Parameters:
alb
- The application load balancer to load balance to. This parameter is required.port
- The port on which the target is listening. This parameter is required.
-