向AWS ELB后面的所有计算机发送请求 [英] Send a request to all machines behind an AWS ELB

查看:95
本文介绍了向AWS ELB后面的所有计算机发送请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在AWS Elastic Load Balancer后面有n个端点,我想对所有这些机器进行REST呼叫. 如果我直接向ELB发出此呼叫,它将仅呼叫其中一台计算机. 所以我的问题是有什么办法实现的吗? 也许我可以使用特定的AWS ELB Api,或者某些我不知道的配置. 在您提出建议之前:我无法将REST更改为其他任何内容,我无法控制该应用程序.

I have n Endpoints behind an AWS Elastic Load Balancer, and I want to make a REST Call to everyone of those machines. If I make this call directly to the ELB, it will call just one of the machines. So my question is there a way yo make it? Maybe a specific AWS ELB Api that I can use, or some configuration I don't know. Before you suggest: I can not change the REST to anything else, I have no control over the application.

推荐答案

您必须绕过负载平衡器才能执行此操作.您可以编写一些内容来查询AWS API的所有连接到负载均衡器的实例,并获取其外部IP地址,然后在每台计算机上调用REST端点.

You'll have to bypass the load balancer to do this. You could write something to query the AWS API for all the instances connected to the load balancer and get their external IP addresses, and then call the REST endpoint on each machine.

此外,负载平衡器后面的计算机将需要安全组配置,该配置使您无需通过负载平衡器就可以向它们发送请求.

Also, the machines behind the load balancer would need a security group configuration that allows you to send requests to them without going through the load balancer.

这些实例是否在Auto Scaling组中?如果在调用这些REST端点的过程中发生自动缩放事件,则可能会导致某些请求失败,或者最终会丢失任何新实例上的REST调用.

Are these instances in an Auto Scaling group? If an auto scaling event occurs while you are in the middle of calling these REST endpoints you could either end up having some requests fail, or you could end up missing the REST call on any new instances.

很显然,有很多优雅的方法可以处理与多个实例的这种通信,但是您将需要能够修改在这些实例上运行的代码.

Obviously there are much more elegant ways to handle this sort of communication to multiple instances, but you would need to be able to modify the code running on those instances.

这篇关于向AWS ELB后面的所有计算机发送请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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