AWS将端口8000从Elb转发到EC2的端口8000 [英] AWS forward port 8000 from elb to port 8000 of EC2

查看:404
本文介绍了AWS将端口8000从Elb转发到EC2的端口8000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ELB中拥有在目标组中注册的多个EC2实例.我正在使用端口php应用程序,它可以正常运行.它具有SSL.

I have en ELB with multiple EC2 instances registered in target groups. I am using port a php application which is running properly. It has SSL.

我想为我的节点应用程序使用端口8000.我想做的是将my-elb-address:8000转发到any-ec2-ip:8000.因此,当我使用端口8000访问附加到ELB的域时,会将其转发到端口8000到ec2.如何实现此目的?他们是否还有其他ELB侦听和转发多个端口的方式?

I want to use port 8000 for my node application. What I would like to do is I want to forward my-elb-address:8000 to any-ec2-ip:8000. So when i access the domain attached to ELB witjh port 8000 it would forward that to ec2 with port 8000. How can I accomplish this? Is their any other way of ELB listening and forwarding multiple ports?

我在ELB中添加了端口80,443和8000的侦听器.请帮助

I have added listener for port 80,443 and 8000 in my ELB. Please help

推荐答案

经典ELB

使用经典" ELB,您可以定义用于转发AWS仪表板中端口的自定义规则:

Classic ELB

Using the "classic" ELB you can define custom rules for forwarding the ports in the AWS dashboard:

请注意,请求将转发到所有个可用实例,这意味着在上面的示例中(假设 php 在80个节点上运行. js (8000上的js ),则所有实例都必须同时运行这两个服务.如果这些服务分别位于不同的实例上,则您将需要两个不同的负载均衡器,每个端口一个.

Mind that the requests will be forwarded to all the available instances, which means in the example above (supposing php is running on the 80, node.js on the 8000) all the instances must have both the services running. If the services are instead on different instances you will need two different load balancers, one per port.

另一个选择是使用应用程序" ELB(ALB). 该选项将允许具有细粒度规则的单个负载均衡器,该规则将允许每种协议将请求转发到一组实例.

Another option is to use an "application" ELB (ALB). This option will allow to have single load balancer with fine-grained rules that will allow, for each protocol, to forward the request to a set of instances.

  • 创建一个默认" ALB
  • 添加一个新的目标组(请参见侧边栏 Load Balancing 部分下的条目),监听您的自定义端口
  • 注册运行您的 node.js 应用程序的实例(右键单击目标组)
  • 将目标组绑定到ALB的听众
  • create a "default" ALB
  • add a new target group (see entry under the Load Balancing section in the sidebar) listening on your custom port
  • register the instances running your node.js application (right click on the target group)
  • bind the target group to the listeners of your ALB

另一种解决方案是,指定基于路径的规则,仅使用一个端口(443),并将仅/to_nodejs下的请求转发到端口8000.

Another solution could be, specifying path-based rules, to use only one port (443) and forward only the requests under /to_nodejs to the port 8000.

这篇关于AWS将端口8000从Elb转发到EC2的端口8000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆