aws-inventory/aws-logs-inventory.sh

17 lines
427 B
Bash
Raw Normal View History

2024-04-19 14:09:45 +08:00
#!/bin/bash
function listRes() {
aws --region $1 logs describe-log-groups | jq -cr '.logGroups[] | [.logGroupName, .retentionInDays, .logGroupClass] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory in all regions
echo "LogGroup, Retention, Class"
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