使用子域进行服务分段的应用程序负载均衡器

Application Load balancer for Service Segmentation Using Subdomains

目前,我正在使用现有应用程序中的子域进行服务细分。

例如:

www.example.com -> static website delivered from s3
admin.example.com -> ELB1 to ec2 group 1
accounts.example.com -> ELB2 to ec2 group 2
search.example.com -> ELB3 to ec2 group 3

你可以看到我需要3个ELB来实现这个。使用新的应用程序负载均衡器,我希望使用路由规则在 1 个负载均衡器上执行此操作。

例如:

www.example.com -> static website delivered from s3
admin.example.com -> ELB1 to ec2 group 1
accounts.example.com -> ELB1 to ec2 group 2
search.example.com -> ELB1 to ec2 group 3

我无法重写我的应用程序来执行此操作。我希望通过应用程序负载均衡器上的路由规则来实现这一点。

我知道我可以为域后面的部分指定规则。我可以为子域指定规则吗?

已读: https://blogs.aws.amazon.com/application-management/post/Tx3RG2S7V2LM4Y2/Introducing-Application-Load-Balancer-Unlocking-and-Optimizing-Architectures

我们也有这个疑问,目前看来没有办法。我们有几个非生产环境都使用子域,所以我们不想创建 30 多个 ELB。我们最终在非生产环境中使用 NGINX 作为代理,但代价是我们必须拥有另一个 EC2 实例。

AWS 最近向 Application Load Balancer 添加了对基于主机的路由的支持:

https://aws.amazon.com/about-aws/whats-new/2017/04/elastic-load-balancing-adds-support-for-host-based-routing-and-increased-rules-on-its-application-load-balancer/