Skip to content
v2.276.0

NetworkLoadBalancerProps Struct ​

Properties to define an network load balancer.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs_patterns as ecs_patterns } from 'aws-cdk-lib';
import { aws_route53 as route53 } from 'aws-cdk-lib';

declare const hostedZone: route53.HostedZone;
const networkLoadBalancerProps: ecs_patterns.NetworkLoadBalancerProps = {
  listeners: [{
    name: 'name',

    // the properties below are optional
    port: 123,
  }],
  name: 'name',

  // the properties below are optional
  domainName: 'domainName',
  domainZone: hostedZone,
  publicLoadBalancer: false,
};
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_ecs_patterns as ecs_patterns
from aws_cdk import aws_route53 as route53

# hosted_zone: route53.HostedZone

network_load_balancer_props = ecs_patterns.NetworkLoadBalancerProps(
    listeners=[ecs_patterns.NetworkListenerProps(
        name="name",

        # the properties below are optional
        port=123
    )],
    name="name",

    # the properties below are optional
    domain_name="domainName",
    domain_zone=hosted_zone,
    public_load_balancer=False
)
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.ecs.patterns.*;
import software.amazon.awscdk.services.route53.*;

HostedZone hostedZone;

NetworkLoadBalancerProps networkLoadBalancerProps = NetworkLoadBalancerProps.builder()
        .listeners(List.of(NetworkListenerProps.builder()
                .name("name")

                // the properties below are optional
                .port(123)
                .build()))
        .name("name")

        // the properties below are optional
        .domainName("domainName")
        .domainZone(hostedZone)
        .publicLoadBalancer(false)
        .build();
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.ECS.Patterns;
using Amazon.CDK.AWS.Route53;

HostedZone hostedZone;

var networkLoadBalancerProps = new NetworkLoadBalancerProps {
    Listeners = new [] { new NetworkListenerProps {
        Name = "name",

        // the properties below are optional
        Port = 123
    } },
    Name = "name",

    // the properties below are optional
    DomainName = "domainName",
    DomainZone = hostedZone,
    PublicLoadBalancer = false
};
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 hostedZone HostedZone

networkLoadBalancerProps := &NetworkLoadBalancerProps{
	Listeners: []NetworkListenerProps{
		&NetworkListenerProps{
			Name: jsii.String("name"),

			// the properties below are optional
			Port: jsii.Number(123),
		},
	},
	Name: jsii.String("name"),

	// the properties below are optional
	DomainName: jsii.String("domainName"),
	DomainZone: hostedZone,
	PublicLoadBalancer: jsii.Boolean(false),
}

Properties ​

domainNameoptionalstringdomain_nameoptionalstrdomainNameoptionalStringDomainNameoptionalstringDomainNameoptional*string#
The domain name for the service, e.g. "api.example.com.".

Default: No domain name.

domainZoneoptionalIHostedZonedomain_zoneoptionalIHostedZonedomainZoneoptionalIHostedZoneDomainZoneoptionalIHostedZoneDomainZoneoptionalIHostedZone#
The Route53 hosted zone for the domain, e.g. "example.com.".

Default: No Route53 hosted domain zone.

listenersNetworkListenerProps[]listenerstyping.List[NetworkListenerProps]listenersList<NetworkListenerProps>ListenersNetworkListenerProps[]Listeners*[]NetworkListenerProps= nonerequired#
Listeners (at least one listener) attached to this load balancer.
namestringnamestrnameStringNamestringName*stringrequired#
Name of the load balancer.
publicLoadBalanceroptionalbooleanpublic_load_balanceroptionalboolpublicLoadBalanceroptionalBooleanPublicLoadBalanceroptionalboolPublicLoadBalanceroptional*bool= true#
Determines whether the Load Balancer will be internet-facing.