How does ports works in architecture.

0

I am trying to create the Application load balancer, target group, and load balancer listener.

In target group and load balancer listener I have specified port as 82, but when I am trying to run the service its not able to run. In my docker i have exposed port 80. In task definition container port and host port I have used is 80 itself.

It would be a great help if someone will explain this port concepts.

My purpose is to link multiple target group in the same ALB so I need ports likewise.

1 Answer
0
Accepted Answer

The port on your listener is the port that's exposed to the Internet, in your case that's port 82. So you can call something like http://my-alb.com:82 The target port of the listener target group must then match the host port of your container. In your case, the target port is 82 but the host port is 80, which means the ALB is trying to communicate with your target on the wrong port. Listener port and the port of the target group on the other hand don't need to match. So what you can do is:

Listener port: 82 Target port: 80 Host port: 80

Also consider that if you have a standard application that uses HTTP or HTTPS, you should generally use the standard ports 80 and 443, respectively, as entry point to your application. You can send all traffic to the same listener (i.e. the same port) on your ALB, and then forward traffic to the different target groups based on listener rules. This way, your targets all can serve requests on the same port.

profile pictureAWS
answered 5 months ago
profile pictureAWS
EXPERT
reviewed 5 months ago
  • Thank you for your answer.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions