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

17 lines
470 B
Bash
Raw Normal View History

#!/bin/bash
function listRes() {
aws --region $1 efs describe-file-systems | jq -cr '.FileSystems[] | [.FileSystemId, .Name, .PerformanceMode, (.SizeInBytes.Value/1024/1024)] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory in all regions
echo "FilesystemId, Name, PerformanceMode, SizeMb"
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