- Newest
- Most votes
- Most comments
Hello.
As stated in the document below, for NLB, HTTP cannot be configured for the listener.
https://awscli.amazonaws.com/v2/documentation/api/latest/reference/elbv2/create-listener.html
--protocol (string)
The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot specify a protocol for a Gateway Load Balancer.
If you set "--elb-type application", an ALB will be created, so I don't think you can achieve the purpose of using a fixed IP address using NLB.
If you want to use an existing NLB, you should be able to use it by setting "--shared-lb" as an option of the "eb create" command and setting the ARN of the NLB.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-create.html
The error occurs because you've created a Network Load Balancer (NLB) but are trying to configure an HTTP listener. Network Load Balancers operate at the transport layer (Layer 4) and only support TCP, UDP, TCP_UDP, and TLS protocols. They don't support HTTP protocol directly.
To resolve this issue, you have two options:
-
If you specifically need HTTP traffic: Change your load balancer type from Network Load Balancer to Application Load Balancer (ALB). ALBs operate at the application layer (Layer 7) and support HTTP and HTTPS protocols. You've already specified '--elb-type application' in your Elastic Beanstalk creation command, which is correct for an ALB.
-
If you want to keep using a Network Load Balancer: Use TCP protocol instead of HTTP for your listener. NLBs can forward TCP traffic to your instances, which can then handle HTTP requests.
Here's how you can modify your listener creation command for each option:
- For Application Load Balancer (recommended for HTTP traffic): First, create an ALB instead of an NLB. Then, use your original listener creation command:
aws elbv2 create-listener
--load-balancer-arn $LB_ARN
--protocol HTTP
--port 80
--default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN
--region $REGION
- For Network Load Balancer: Change the protocol to TCP:
aws elbv2 create-listener
--load-balancer-arn $LB_ARN
--protocol TCP
--port 80
--default-actions Type=forward,TargetGroupArn=$TARGET_GROUP_ARN
--region $REGION
Remember to adjust your target group settings to match the load balancer type you choose. For an ALB, your current HTTP target group is fine. For an NLB, you'd need to create a TCP target group instead.
Given that you want HTTP communication and you've already specified an application load balancer type in your Elastic Beanstalk command, the first option (using an ALB) is likely the most appropriate for your use case.
Sources
Create a listener for your Network Load Balancer - Elastic Load Balancing
CreateListener - Elastic Load Balancing
Create an HTTP listener for your Application Load Balancer - Elastic Load Balancing
answered 2 years ago

Thanks, I will try the --shared-lb option. I was able to achieve to create NLB with Elastic IP using GUI and route the traffic to my beanstalk app, so I believe its possible to do so.