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

17 lines
413 B
Bash
Executable File

#!/bin/bash
function listRes() {
aws --region $1 opensearch list-domain-names | jq -cr '.DomainNames[] | [.DomainName, .EngineType] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "DomainName, EngineType"
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