List resources in all regions using awsls
Publicado: 2021-07-12
We can use awsls
to list resources in our AWS account. If the account is new for us, and we want to discover if any resource exists in all region, not only in the ones that we are used to, we can get this list of regions using the following snippet:
ALL_REGIONS=$(aws ec2 describe-regions --filters "Name=opt-in-status,Values=[opt-in-not-required,opted-in]" --output text --query "join(',', Regions[*].RegionName)")
awsls aws_instance --regions ${ALL_REGIONS}
Output:
TYPE ID PROFILE REGION CREATED
aws_instance i-xxxxxxxxxxxxxxxxx N/A eu-west-1 2021-07-12 06:30:24
aws_instance i-xxxxxxxxxxxxxxxxx N/A eu-west-1 2021-05-24 06:30:21
aws_instance i-xxxxxxxxxxxxxxxxx N/A eu-west-2 2021-07-12 06:30:24
aws_instance i-xxxxxxxxxxxxxxxxx N/A eu-west-2 2021-04-25 13:22:20