Skip to content
v2.278.0

Protocol Enum ​

Backend protocol for network load balancers and health checks.

Example ​

ts
declare const vpc: ec2.Vpc;

const lb = new elbv2.NetworkLoadBalancer(this, 'LB', {
  vpc,
  ipAddressType: elbv2.IpAddressType.DUAL_STACK,
  enablePrefixForIpv6SourceNat: true,
});

const listener = lb.addListener('Listener', {
  port: 1229,
  protocol: elbv2.Protocol.UDP,
});
python
# vpc: ec2.Vpc


lb = elbv2.NetworkLoadBalancer(self, "LB",
    vpc=vpc,
    ip_address_type=elbv2.IpAddressType.DUAL_STACK,
    enable_prefix_for_ipv6_source_nat=True
)

listener = lb.add_listener("Listener",
    port=1229,
    protocol=elbv2.Protocol.UDP
)
java
Vpc vpc;


NetworkLoadBalancer lb = NetworkLoadBalancer.Builder.create(this, "LB")
        .vpc(vpc)
        .ipAddressType(IpAddressType.DUAL_STACK)
        .enablePrefixForIpv6SourceNat(true)
        .build();

NetworkListener listener = lb.addListener("Listener", BaseNetworkListenerProps.builder()
        .port(1229)
        .protocol(Protocol.UDP)
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;


var lb = new NetworkLoadBalancer(this, "LB", new NetworkLoadBalancerProps {
    Vpc = vpc,
    IpAddressType = IpAddressType.DUAL_STACK,
    EnablePrefixForIpv6SourceNat = true
});

var listener = lb.AddListener("Listener", new BaseNetworkListenerProps {
    Port = 1229,
    Protocol = Protocol.UDP
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc


lb := elbv2.NewNetworkLoadBalancer(this, jsii.String("LB"), &NetworkLoadBalancerProps{
	Vpc: Vpc,
	IpAddressType: elbv2.IpAddressType_DUAL_STACK,
	EnablePrefixForIpv6SourceNat: jsii.Boolean(true),
})

listener := lb.AddListener(jsii.String("Listener"), &BaseNetworkListenerProps{
	Port: jsii.Number(1229),
	Protocol: elbv2.Protocol_UDP,
})

Members ​

MemberDescription
HTTPHTTP (ALB health checks and NLB health checks).
HTTPSHTTPS (ALB health checks and NLB health checks).
TCPTCP (NLB, NLB health checks).
TLSTLS (NLB).
UDPUDP (NLB).
TCP_UDPListen to both TCP and UDP on the same port (NLB).

Referenced by ​