Skip to content

Instantly share code, notes, and snippets.

@JCotton1123
Created March 1, 2019 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JCotton1123/4da6465d1d2ce6e46f343a30cab6f920 to your computer and use it in GitHub Desktop.
Save JCotton1123/4da6465d1d2ce6e46f343a30cab6f920 to your computer and use it in GitHub Desktop.
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