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

17 lines
483 B
Bash
Raw Normal View History

#!/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