Class LoadBalancer
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.elasticloadbalancing.LoadBalancer
- All Implemented Interfaces:
IResource
,IConnectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-11-21T06:34:08.070Z")
@Stability(Stable)
public class LoadBalancer
extends Resource
implements IConnectable
A load balancer with a single listener.
Routes to a fleet of of instances in a VPC.
Example:
Cluster cluster; TaskDefinition taskDefinition; Vpc vpc; Ec2Service service = Ec2Service.Builder.create(this, "Service").cluster(cluster).taskDefinition(taskDefinition).build(); LoadBalancer lb = LoadBalancer.Builder.create(this, "LB").vpc(vpc).build(); lb.addListener(LoadBalancerListener.builder().externalPort(80).build()); lb.addTarget(service.loadBalancerTarget(LoadBalancerTargetOptions.builder() .containerName("MyContainer") .containerPort(80) .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.ec2.IConnectable
IConnectable.Jsii$Default, IConnectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
LoadBalancer
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
LoadBalancer
(software.amazon.jsii.JsiiObjectRef objRef) LoadBalancer
(software.constructs.Construct scope, String id, LoadBalancerProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(LoadBalancerListener listener) Add a backend to the load balancer.void
addTarget
(ILoadBalancerTarget target) Control all connections from and to this load balancer.An object controlling specifically the connections for each listener added to this load balancer.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
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, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
LoadBalancer
protected LoadBalancer(software.amazon.jsii.JsiiObjectRef objRef) -
LoadBalancer
protected LoadBalancer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
LoadBalancer
@Stability(Stable) public LoadBalancer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull LoadBalancerProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
addListener
Add a backend to the load balancer.- Parameters:
listener
- This parameter is required.- Returns:
- A ListenerPort object that controls connections to the listener port
-
addTarget
- Parameters:
target
- This parameter is required.
-
getConnections
Control all connections from and to this load balancer.- Specified by:
getConnections
in interfaceIConnectable
-
getListenerPorts
An object controlling specifically the connections for each listener added to this load balancer. -
getLoadBalancerCanonicalHostedZoneName
-
getLoadBalancerCanonicalHostedZoneNameId
-
getLoadBalancerDnsName
-
getLoadBalancerName
-
getLoadBalancerSourceSecurityGroupGroupName
-
getLoadBalancerSourceSecurityGroupOwnerAlias
-