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

19 lines
519 B
Bash
Raw Normal View History

#!/bin/bash
function listRes() {
aws --region $1 eks list-clusters --query clusters[] --output text | sed -e 's/\t/\n/g' | while read i; do
aws --region $1 eks describe-cluster --name $i | jq -cr '.cluster | [.name, .version] | @csv' | tr -d \"
done
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "ClusterName,ClusterVersion"
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