Is it possible to list all resources in AWS account using AWS cli?
No. There is no direct method or command for that. But there is a workaround for that. In this post I’m gonna show you how to list all resources in an AWS account.
In AWS console, we can see all resources in a region using Tag Editor. We can do the same with aws cli. The command for this is:
aws resourcegroupstaggingapi get-resources --region us-east-1
The above command will list all resources in North Virginia region with tag names.
To get all resources across all regions, we just need to run the above command in a loop with region name as parameter
The script would look like
for region in `aws ec2 describe-regions --region us-east-1 --output text | cut -f4`
echo -e "\nListing Instances in '$region' region..."
aws resourcegroupstaggingapi get-resources --region $region