问题
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.
It is possible? What is the easiest way to do? Should I use API?
回答1:
That's fairly straightforward using awscli / API.
Get healthy instance IDs from ELB using
aws elb describe-instance-health
. Lots of examples here: AWS CLI - elb describe-instance-healthGet IP addresses of your healthy instances by using
aws ec2 describe-instances
. Docs here: AWS CLI - ec2 describe-instancesOnce you have IP addresses just do what is needed on your EC2 instances (make sure your security groups are set up properly).
来源:https://stackoverflow.com/questions/30445647/is-there-any-way-to-send-a-http-request-to-all-instances-in-a-aws-elb