Last active
June 10, 2022 22:14
-
-
Save aerostitch/d72d6f159f099f9338cd7a2da6246cdf to your computer and use it in GitHub Desktop.
Lists all the ELB names and the number of instances attached to them
This file contains hidden or 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 elb describe-load-balancers --query 'LoadBalancerDescriptions[*].{name:LoadBalancerName,instances:Instances[*].InstanceId}' | jq '[.[] | {name: .name, inst: .instances | length}]' | |
# List only the empty ones: | |
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].{name:LoadBalancerName,instances:Instances[*].InstanceId}' | jq '[.[] | if (.instances | length) <= 0 then {name: .name, number_of_instances: .instances | length} else empty end]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment