Created
May 31, 2016 21:15
-
-
Save nshenry03/ccdc551945c16ad131582604fab8c604 to your computer and use it in GitHub Desktop.
Find instances that are out of service for each load balancer in an Amazon account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWS_CONFIG_PROFILE='prod' # from ${HOME}/.aws-config | |
for elb in $( | |
aws elb describe-load-balancers --profile "${AWS_CONFIG_PROFILE}" | \ | |
jq '.LoadBalancerDescriptions | .[] | .LoadBalancerName' | \ | |
sed 's/"//g' | |
) ; do | |
echo -e "ELB: ${elb}\n========================================" | |
aws elb describe-instance-health \ | |
--load-balancer-name ${elb} --profile "${AWS_CONFIG_PROFILE}" | \ | |
jq '.InstanceStates | .[] | select(.State!="InService") | .InstanceId' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment