Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this bash line that gives me the IPs of the EC2 instances attached.

export LB_NAME='lb'
ec2-describe-instances `elb-describe-instance-health $LB_NAME --show-long | cut -d , -f 2` | grep 'INSTANCE' | cut  -f 4

This echoes something like this:

Now, as this list can get longer when the autoscaler adds more boxes to the loadbalancer, I would like to have a bash loop that pings each one of them regardless of how many are there.

Thanks a lot!

share|improve this question
up vote 6 down vote accepted

<rest of pipeline> | xargs ping -c 1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.