diff --git a/aws/aws-inventory2.sh b/aws/aws-inventory2.sh index aaf83e5..8741d9d 100755 --- a/aws/aws-inventory2.sh +++ b/aws/aws-inventory2.sh @@ -4,7 +4,7 @@ function list-resources-in-region { export AWS_DEFAULT_REGION=$1 echo "---" - echo "# Region: $r" + echo "# Region: $1" echo "---" echo -e "\n## EC2:" aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId, Tags[?Key==`Name`].Value[] | [0], PlatformDetails, InstanceType,PrivateIpAddress]' --output json | jq -cr '.[][] | @tsv' | tr -d '[\" ' @@ -41,12 +41,14 @@ function list-resources-in-region { } # Generate inventory of ec2, rds, lb, and s3 buckets. -aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do - list-resources-in-region $r > /tmp/aws-inventory-$r.txt & -done +export -f list-resources-in-region +aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | parallel list-resources-in-region {} +#aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do +# list-resources-in-region $r > /tmp/aws-inventory-$r.txt & +#done -echo "This may take a moment..." -sleep 50 +# echo "This may take a moment..." +# sleep 50 -cat /tmp/aws-inventory*.txt -rm -f /tmp/aws-inventory*.txt +#cat /tmp/aws-inventory*.txt +#rm -f /tmp/aws-inventory*.txt