#!/bin/bash function listRes() { aws rds describe-db-instances --region $1 | jq -cr '.DBInstances[] | [.DBInstanceIdentifier, .DBInstanceClass, .Engine, .AvailabilityZone, .MultiAZ] | @csv' | tr -d \" } export -f listRes # Generate inventory of ec2 in all regions echo "InstanceId,InstanceClass,Engine,AZ,MultiAz" 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