aws-inventory/aws-rds-inventory.sh
2024-04-19 14:09:45 +08:00

17 lines
483 B
Bash
Executable File

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