Is there any way to send a http request to all ins

2019-05-27 01:30发布

问题:

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.

  1. Get healthy instance IDs from ELB using aws elb describe-instance-health. Lots of examples here: AWS CLI - elb describe-instance-health

  2. Get IP addresses of your healthy instances by using aws ec2 describe-instances. Docs here: AWS CLI - ec2 describe-instances

  3. Once you have IP addresses just do what is needed on your EC2 instances (make sure your security groups are set up properly).