Created
March 1, 2019 05:34
-
-
Save JCotton1123/4da6465d1d2ce6e46f343a30cab6f920 to your computer and use it in GitHub Desktop.
Primitive script for enumerating AWS services in use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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