Nadeem Yasin
Nadeem Yasin

Reputation: 4524

AWS - ELB - Routing http/https traffic to a custom port of EC2 instance

I've an application up and running on and EC2 instance at port 5000. I've been trying to add either application load balancer or classic load balancer to route my traffic to this application.

Until at this point, the application is available over HTTP protocol at http://example.com:5000/.

So my question is, what steps I need to do to make this application available without typing the port number in the URL.

Please note that I want to have multiple instances of the app up and running at different ports and are mapped to different subdomains.

Thanks

Upvotes: 1

Views: 2219

Answers (1)

Nadeem Yasin
Nadeem Yasin

Reputation: 4524

So after spending couple of hours and going through the documentation again, this is how it worked for me.

  1. Created an Application load balancer
  2. Created a Target Group that listens on HTTP port 80.
  3. In this target group, selected the ec2 instance and registered it on port 5000
  4. In the load balancer section, added two listeners. One for HTTP and one for HTTPs. Added default action to forward all traffic to that Target Group that was created in step 2. and it all worked for me.

The important bit was to set up the Target Group in step 2 and 3 correctly. I was creating two target groups for http and https separately which was incorrect. I just had to creat one target group for http only.

Upvotes: 2

Related Questions