How to use one AWS loadbalancer for multiple services

Nidhi
2 min readMay 12, 2021

When you have multiple applications which are running inside an ECS cluster or anywhere else then how can you use just one loadbalancer for all the applications.

Using separate loadbalancer for each of the services/applications will be more expensive as each LB cost around $15/month and if you have 5 services then this would be $75/month.

Example:

You have an application which is listening on port 8080 and it requires SSL certificates.

  • Application can listen on same or different port also

Solution

  • Define the instance port in the Target Group
  • configure the Target Group to use port 8080 or whatever your application is listening on.
  • 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.

ALB configuration

Below is an example of one ALB which is listening on port 80 and 443

--

--

Nidhi
Nidhi

Written by Nidhi

Devops Automation Enginneer

No responses yet