API resource groups tagging#
Sometimes you need a list of all resources in your AWS account. For this use case, you can use the API operations resource groups tagging.
Following command will list all resources in region Frankfurt with tag names:
aws resourcegroupstaggingapi get-resources --region eu-central-1 --output jsonTo get all resources across all regions, you need to run the above command in a loop with region name as parameter.
Create script get-resources.sh#
#!/bin/bash
for region in `aws ec2 describe-regions --region us-east-1 --output text | cut -f4`
do
echo -e "\nListing Instances in '$region' region..."
aws resourcegroupstaggingapi get-resources --region $region
doneThis allows you to see the overall resources without having to check for each region and each service.
Run the script#
export AWS_PROFILE=xxxx
./get-resources.shNotes#
Not all resources can have tags. For a list of resources that you can tag, see Supported Resources in the AWS Resource Groups and Tag Editor User Guide.
