Created
March 13, 2018 15:36
-
-
Save garyellis/f9c3e5333d14df268f0225caed567bde to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
function get_classic_elb_backend_counts(){ | |
region=${2:-us-west-2} | |
aws --profile $1 --region $region elb describe-load-balancers | \ | |
jq -r --arg profile "$1" --arg region "$region" '.LoadBalancerDescriptions[] | [$profile, $region, .LoadBalancerName, (.Instances|length)] | @csv' | |
} | |
function aws_regions(){ | |
aws ec2 describe-regions | jq -r '.Regions[].RegionName' | |
} | |
function get_classic_elb_backend_counts_all_regions() { | |
for region in $(aws_regions); do | |
get_classic_elb_backend_counts $1 $region | |
done | |
} | |
get_classic_elb_backend_counts_all_regions $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment