Class NetworkLoadBalancer
- All Implemented Interfaces:
IResource
,IConnectable
,IVpcEndpointServiceLoadBalancer
,ILoadBalancerV2
,INetworkLoadBalancer
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
Example:
import software.amazon.awscdk.aws_apigatewayv2_integrations.HttpNlbIntegration; Vpc vpc = new Vpc(this, "VPC"); NetworkLoadBalancer lb = NetworkLoadBalancer.Builder.create(this, "lb").vpc(vpc).build(); NetworkListener listener = lb.addListener("listener", BaseNetworkListenerProps.builder().port(80).build()); listener.addTargets("target", AddNetworkTargetsProps.builder() .port(80) .build()); HttpApi httpEndpoint = HttpApi.Builder.create(this, "HttpProxyPrivateApi") .defaultIntegration(new HttpNlbIntegration("DefaultIntegration", listener)) .build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkLoadBalancer
INetworkLoadBalancer.Jsii$Default, INetworkLoadBalancer.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
NetworkLoadBalancer
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
NetworkLoadBalancer
(software.amazon.jsii.JsiiObjectRef objRef) NetworkLoadBalancer
(software.constructs.Construct scope, String id, NetworkLoadBalancerProps props) -
Method Summary
Modifier and TypeMethodDescriptionaddListener
(String id, BaseNetworkListenerProps props) Add a listener to this load balancer.void
addSecurityGroup
(ISecurityGroup securityGroup) Add a security group to this load balancer.static INetworkLoadBalancer
fromLookup
(software.constructs.Construct scope, String id, NetworkLoadBalancerLookupOptions options) Looks up the network load balancer.static INetworkLoadBalancer
fromNetworkLoadBalancerAttributes
(software.constructs.Construct scope, String id, NetworkLoadBalancerAttributes attrs) The network connections associated with this resource.Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink.The type of IP addresses to use.All metrics available for this load balancer.After the implementation ofIConnectable
(see https://github.com/aws/aws-cdk/pull/28494), the default value forsecurityGroups
is set by theec2.Connections
constructor to an empty array.Deprecated.metric
(String metricName, MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.custom
insteadDeprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
insteadmetricConsumedLCUs
(MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.newFlowCount
insteadmetricNewFlowCount
(MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.newFlowCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.processedBytes
insteadDeprecated.UseNetworkLoadBalancer.metrics.processedBytes
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpClientResetCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpClientResetCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpElbResetCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpElbResetCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpTargetResetCount
insteadDeprecated.UseNetworkLoadBalancer.metrics.tcpTargetResetCount
insteadMethods inherited from class software.amazon.awscdk.services.elasticloadbalancingv2.BaseLoadBalancer
getLoadBalancerArn, getLoadBalancerCanonicalHostedZoneId, getLoadBalancerDnsName, getLoadBalancerFullName, getLoadBalancerName, getLoadBalancerSecurityGroups, getVpc, logAccessLogs, logAccessLogs, removeAttribute, resourcePolicyPrincipal, setAttribute, setAttribute, validateLoadBalancer
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.awscdk.services.elasticloadbalancingv2.ILoadBalancerV2
getLoadBalancerCanonicalHostedZoneId, getLoadBalancerDnsName
Methods inherited from interface software.amazon.awscdk.services.elasticloadbalancingv2.INetworkLoadBalancer
getVpc
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.awscdk.services.ec2.IVpcEndpointServiceLoadBalancer
getLoadBalancerArn
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
NetworkLoadBalancer
protected NetworkLoadBalancer(software.amazon.jsii.JsiiObjectRef objRef) -
NetworkLoadBalancer
protected NetworkLoadBalancer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
NetworkLoadBalancer
@Stability(Stable) public NetworkLoadBalancer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkLoadBalancerProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
fromLookup
@Stability(Stable) @NotNull public static INetworkLoadBalancer fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkLoadBalancerLookupOptions options) Looks up the network load balancer.- Parameters:
scope
- This parameter is required.id
- This parameter is required.options
- This parameter is required.
-
fromNetworkLoadBalancerAttributes
@Stability(Stable) @NotNull public static INetworkLoadBalancer fromNetworkLoadBalancerAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull NetworkLoadBalancerAttributes attrs) - Parameters:
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.
-
addListener
@Stability(Stable) @NotNull public NetworkListener addListener(@NotNull String id, @NotNull BaseNetworkListenerProps props) Add a listener to this load balancer.- Specified by:
addListener
in interfaceINetworkLoadBalancer
- Parameters:
id
- This parameter is required.props
- This parameter is required.- Returns:
- The newly created listener
-
addSecurityGroup
Add a security group to this load balancer.- Parameters:
securityGroup
- This parameter is required.
-
metric
@Stability(Deprecated) @Deprecated @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.custom
instead(deprecated) Return the given named metric for this Network Load Balancer.Default: Average over 5 minutes
- Parameters:
metricName
- This parameter is required.props
-
-
metric
Deprecated.UseNetworkLoadBalancer.metrics.custom
instead(deprecated) Return the given named metric for this Network Load Balancer.Default: Average over 5 minutes
- Parameters:
metricName
- This parameter is required.
-
metricActiveFlowCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricActiveFlowCount(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
instead(deprecated) The total number of concurrent TCP flows (or connections) from clients to targets.This metric includes connections in the SYN_SENT and ESTABLISHED states. TCP connections are not terminated at the load balancer, so a client opening a TCP connection to a target counts as a single flow.
Default: Average over 5 minutes
- Parameters:
props
-
-
metricActiveFlowCount
Deprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
instead(deprecated) The total number of concurrent TCP flows (or connections) from clients to targets.This metric includes connections in the SYN_SENT and ESTABLISHED states. TCP connections are not terminated at the load balancer, so a client opening a TCP connection to a target counts as a single flow.
Default: Average over 5 minutes
-
metricConsumedLCUs
@Stability(Deprecated) @Deprecated @NotNull public Metric metricConsumedLCUs(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
instead(deprecated) The number of load balancer capacity units (LCU) used by your load balancer.Default: Sum over 5 minutes
- Parameters:
props
-
-
metricConsumedLCUs
Deprecated.UseNetworkLoadBalancer.metrics.activeFlowCount
instead(deprecated) The number of load balancer capacity units (LCU) used by your load balancer.Default: Sum over 5 minutes
-
metricNewFlowCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricNewFlowCount(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.newFlowCount
instead(deprecated) The total number of new TCP flows (or connections) established from clients to targets in the time period.Default: Sum over 5 minutes
- Parameters:
props
-
-
metricNewFlowCount
Deprecated.UseNetworkLoadBalancer.metrics.newFlowCount
instead(deprecated) The total number of new TCP flows (or connections) established from clients to targets in the time period.Default: Sum over 5 minutes
-
metricProcessedBytes
@Stability(Deprecated) @Deprecated @NotNull public Metric metricProcessedBytes(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.processedBytes
instead(deprecated) The total number of bytes processed by the load balancer, including TCP/IP headers.Default: Sum over 5 minutes
- Parameters:
props
-
-
metricProcessedBytes
Deprecated.UseNetworkLoadBalancer.metrics.processedBytes
instead(deprecated) The total number of bytes processed by the load balancer, including TCP/IP headers.Default: Sum over 5 minutes
-
metricTcpClientResetCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricTcpClientResetCount(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.tcpClientResetCount
instead(deprecated) The total number of reset (RST) packets sent from a client to a target.These resets are generated by the client and forwarded by the load balancer.
Default: Sum over 5 minutes
- Parameters:
props
-
-
metricTcpClientResetCount
Deprecated.UseNetworkLoadBalancer.metrics.tcpClientResetCount
instead(deprecated) The total number of reset (RST) packets sent from a client to a target.These resets are generated by the client and forwarded by the load balancer.
Default: Sum over 5 minutes
-
metricTcpElbResetCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricTcpElbResetCount(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.tcpElbResetCount
instead(deprecated) The total number of reset (RST) packets generated by the load balancer.Default: Sum over 5 minutes
- Parameters:
props
-
-
metricTcpElbResetCount
Deprecated.UseNetworkLoadBalancer.metrics.tcpElbResetCount
instead(deprecated) The total number of reset (RST) packets generated by the load balancer.Default: Sum over 5 minutes
-
metricTcpTargetResetCount
@Stability(Deprecated) @Deprecated @NotNull public Metric metricTcpTargetResetCount(@Nullable MetricOptions props) Deprecated.UseNetworkLoadBalancer.metrics.tcpTargetResetCount
instead(deprecated) The total number of reset (RST) packets sent from a target to a client.These resets are generated by the target and forwarded by the load balancer.
Default: Sum over 5 minutes
- Parameters:
props
-
-
metricTcpTargetResetCount
Deprecated.UseNetworkLoadBalancer.metrics.tcpTargetResetCount
instead(deprecated) The total number of reset (RST) packets sent from a target to a client.These resets are generated by the target and forwarded by the load balancer.
Default: Sum over 5 minutes
-
getConnections
The network connections associated with this resource.- Specified by:
getConnections
in interfaceIConnectable
-
getMetrics
All metrics available for this load balancer.- Specified by:
getMetrics
in interfaceINetworkLoadBalancer
-
getEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic
@Stability(Stable) @Nullable public String getEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic()Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink.- Specified by:
getEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic
in interfaceINetworkLoadBalancer
-
getIpAddressType
The type of IP addresses to use.- Specified by:
getIpAddressType
in interfaceINetworkLoadBalancer
-
getSecurityGroups
After the implementation ofIConnectable
(see https://github.com/aws/aws-cdk/pull/28494), the default value forsecurityGroups
is set by theec2.Connections
constructor to an empty array. To keep backward compatibility (securityGroups
isundefined
if the related property is not specified) a getter has been added.- Specified by:
getSecurityGroups
in interfaceINetworkLoadBalancer
-
NetworkLoadBalancer.metrics.custom
instead