code-dumps/aws/aws-elbv2-inventory.sh

17 lines
438 B
Bash
Raw Normal View History

#!/bin/bash
function listRes() {
aws elbv2 describe-load-balancers | jq -cr '.LoadBalancers[] | [.LoadBalancerName, .Scheme, .Type, .AvailabilityZones[0].ZoneName] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory in all regions
echo "LbName,Scheme,Type,AZ1"
aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
sem -j6 listRes $r
done
sem --wait