Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Primitive script for enumerating AWS services in use
#!/bin/bash
services=""
page_token=""
while true; do
results=$(aws resourcegroupstaggingapi get-resources --tags-per-page 500 --pagination-token="$page_token")
more_services=$(echo "$results" | egrep -o 'arn:aws:([a-z]+):' | cut -d: -f 3 | sort | uniq)
services=$(echo -e "$services\n$more_services" | sort | uniq)
page_token=$(echo "$results" | grep "PaginationToken" | cut -d\" -f4)
[ -z "$page_token" ] && break
done
echo $services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment