有什么方法可以将HTTP请求发送到AWS ELB中的所有实例? [英] Is there any way to send a http request to all instances in a AWS ELB?
问题描述
我将使用Amazon Auto Scaling制作一系列Varnish服务器.这样,我就必须向负载平衡器上运行状况良好的所有服务器发送清除请求.
I will make an array of Varnish servers using Amazon Auto Scaling. With that, I'll have to send a purge request to all servers that are as healthy on the load balancer.
有可能吗?最简单的方法是什么?我应该使用API吗?
It is possible? What is the easiest way to do? Should I use API?
推荐答案
使用awscli/API相当简单.
That's fairly straightforward using awscli / API.
-
使用
aws elb describe-instance-health
从ELB获取正常的实例ID.这里有很多示例: AWS CLI-elb describe-实例健康
Get healthy instance IDs from ELB using
aws elb describe-instance-health
. Lots of examples here: AWS CLI - elb describe-instance-health
通过使用aws ec2 describe-instances
获取正常实例的IP地址.此处的文档: AWS CLI-ec2 describe-instances
Get IP addresses of your healthy instances by using aws ec2 describe-instances
. Docs here: AWS CLI - ec2 describe-instances
一旦您拥有IP地址,就可以执行EC2实例上所需的操作(确保正确设置了安全组).
Once you have IP addresses just do what is needed on your EC2 instances (make sure your security groups are set up properly).
这篇关于有什么方法可以将HTTP请求发送到AWS ELB中的所有实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!