Running multiple Spring Boot apps in a single EC2 instance

六月ゝ 毕业季﹏ 提交于 2019-12-11 16:14:04

问题


I am trying to deploy multiple spring boot web applications with embedded tomcat in a single EC2 instance.

With an embedded tomcat (I prefer to decouple my apps runtime), each one of these apps should be running on a different port (let's say 8081, 8082 and 8083).

For each of these apps I would like to point a domain:

  • app1.domaine.com should point to APP1 running on 8081
  • app2.domaine.com should point to APP2 running on 8082
  • app3.domaine.com should point to APP3 running on 8083

Do you think it's possible to go ahead with a single instance ?

I am not sure if the CloudFront+ELB could do the trick.


回答1:


You can't do this with a Classic Load Balancer, but you can do it with a Application Load Balancer.

ALB supports host-based routing, so create one route for each hostname. Each route will have an associated target group, and all 3 target groups can point to the same instance but different ports.

You can do the same thing with paths if you don' want different domains - i.e. you can have domaine.com/app1, domaine.com/app2 and domaine.com/app3 each associated with different target groups.



来源:https://stackoverflow.com/questions/49437365/running-multiple-spring-boot-apps-in-a-single-ec2-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!