Syed
Syed

Reputation: 29

How to do port forwarding in AWS ALB

I have an apache server running on ec2 behind ALB listening on port 3000. I would like to know to how do i port forward from ALB's port 80 to ec2's port 3000. I tried creating target group with port 3000 but in vein. Pls suggest me how to achieve this. Thanks in advance.

Upvotes: 2

Views: 3252

Answers (1)

Adiii
Adiii

Reputation: 59906

The port mapping in case of AWS is pretty much simple. Target (ec2 instance) and the ALB that's it.

ALB only forward traffic to healthy instance, so there might be the case the target is not healthy, better to post ALB status code or response when you hit endpoint.

enter image description here You need to specify port 3000 in the target group and map 3000 to port 80 of the load balancer.

Go to your target group and verify the health of the target group

enter image description here

If you see the status columns in the screenshot, if it is healhty then you need check ALB security group, if the status is not healhty then you need to check the application either not running or either the security group not allowing the traffic.

Upvotes: 6

Related Questions