<p>You can archive that, but you will need to use the Application Load Balancer (ALB) which allows you to create rules (like HTTP URL paths, host header conditionals, query strings, HTTP method) to forward the traffic to a specific pool of servers that on your case would be those 2 EC2 instances. </p>

<p>e.g.:</p>

<p>/app1 --> :/app1
/app2 --> :/app2</p>

<p>Notice that you should have the ALB rule like this: <code>/app1/*</code> and <code>/app2/*</code> </p>

CC BY-SA 4.0
2019-08-01T06:23:22.547Z
2019-08-01T06:23:22.547Z
Dennis Ruiz
<p>I have 2 EC2 instances and an Application Load Balancer.</p>

<p>The Load is not too high, but I'm keeping both instances working just in case. 
Plus, it saves the time on deployment with (one at a time) and still provides "no downtime".</p>

<p>Now I need to add another project. </p>

<p>I'd like to use my EC2 instances and only create a new Load Balancer for it.</p>

<p>Can I do it?</p>

<p>I mean, I can place projects in folders in EC2, but I cannot find a way to set Load Balancer to use a specific folder instead of the root.</p>

<p>My best guess now is to set Nginx to use port 80 for first project and 81 for the second one. But I haven't try it yet. Is there a better way? Are there any hidden problems?</p>

<amazon-web-services><amazon-ec2><load-balance>
multiple projects per EC2 with Load Balancers
Yevgeniy Afanasyev
# multiple projects per EC2 with Load Balancers

(Asked by: username_0 on 2019-08-01)

I have 2 EC2 instances and an Application Load Balancer.

The Load is not too high, but I'm keeping both instances working just in case.
Plus, it saves the time on deployment with (one at a time) and still provides "no downtime".

Now I need to add another project.

I'd like to use my EC2 instances and only create a new Load Balancer for it.

Can I do it?

I mean, I can place projects in folders in EC2, but I cannot find a way to set Load Balancer to use a specific folder instead of the root.

My best guess now is to set Nginx to use port 80 for first project and 81 for the second one. But I haven't try it yet. Is there a better way? Are there any hidden problems?

**Tags:** amazon-web-services, amazon-ec2, load-balance


---

## 1 answers

### Answer by username_1 on 2019-08-01. Score: 1

You can archive that, but you will need to use the Application Load Balancer (ALB) which allows you to create rules (like HTTP URL paths, host header conditionals, query strings, HTTP method) to forward the traffic to a specific pool of servers that on your case would be those 2 EC2 instances.

e.g.:

/app1 --> :/app1
/app2 --> :/app2

Notice that you should have the ALB rule like this: `/app1/*` and `/app2/*`


---

