Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to forward port in AWS Application load balancer (ALB) port forwarding

Is it possible to have an application running on an EC2 instance and have a load balancer listen on port 80 but proxy it to the instances port 8080?

I cannot seem to get this to work. What setting to I need to change. I am running the cluster behind an application load balancer.

like image 472
Subtubes Avatar asked Feb 24 '17 02:02

Subtubes


People also ask

How do I open a port in Alb?

You define the instance port in the Target Group. You need to configure the Target Group to use port 8080. Then point the Application Load Balancer's port 80 listener to the Target Group. The ALB will listen on port 80, and forward requests to port 8080 on the Target Group instances.

What is port forwarding in load balancer?

What is port forwarding? Port forwarding lets you connect to specific virtual machines by using the Load Balancer frontend IP address and port number. Load Balancer, upon receiving the traffic on a certain frontend port, will forward traffic to the target virtual machine on a specific backend port.

Which ports can application load balancer work on?

By creating an AWS Load Balancer, you can let the load balancer listen on port 80 or 443 and have it route traffic to another port on your EC2 instance. Usually, a load balancer sits in front of multiple EC2 instances and manages traffic coming in.


2 Answers

Adding answer with AWS management snippets .

Add the instance port in the target group, refer below image for it. for example i've added tomcat 8080 port to the target group port/

enter image description here

Make sure that your ELB is internet facing. refer below image of ELB summary , which says that my ELB is internet -facing. and check that your routing is properly added.

enter image description here

like image 125
Amit Avatar answered Oct 19 '22 07:10

Amit


You define the instance port in the Target Group. You need to configure the Target Group to use port 8080. Then point the Application Load Balancer's port 80 listener to the Target Group. The ALB will listen on port 80, and forward requests to port 8080 on the Target Group instances.

like image 19
Mark B Avatar answered Oct 19 '22 08:10

Mark B