19 lines
594 B
Bash
19 lines
594 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
function listRes() {
|
||
|
aws --region $1 emr list-clusters --query Clusters[].Id --output text | sed 's/\t/\n/g' | while read i; do
|
||
|
aws --region $1 emr describe-cluster --cluster-id $i | jq -cr '.Cluster | [.Id, .Name, .ReleaseLabel, .Ec2InstanceAttributes.Ec2AvailabilityZone] | @csv' | tr -d \"
|
||
|
done
|
||
|
}
|
||
|
|
||
|
export -f listRes
|
||
|
|
||
|
# Generate inventory of ec2 in all regions
|
||
|
|
||
|
echo "ClusterId,ClusterName,ReleaseLabel,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
|