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

17 lines
472 B
Bash
Raw Normal View History

#!/bin/bash
function listRes() {
aws elasticache --region $1 describe-cache-clusters | jq -cr '.CacheClusters[] | [.CacheClusterId, .CacheNodeType, .Engine, .PreferredAvailabilityZone] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "ClusterId,NodeType,Engine,AZ"
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