0

In AWS Backup, I have created a resource assignment to a backup-plan, which targets all EC2 instances.

The ARN prefix looks like this:

arn:aws:ec2:*:*:instance/*

How can I list all instances that match an ARN prefix? Either in AWS Cloudshell or with the aws cli?

Jeppe
  • 1,830
  • 3
  • 24
  • 33

1 Answers1

1

I think you can try using ec2's describe-instances cli command and run it over all AWS regions :

for region in `aws ec2 describe-regions --output text | cut -f3`
do
     echo -e "\nListing Instances in region:'$region'..."
     aws ec2 describe-instances --region $region
done
  • Thank you for your reply. It may be equivalent to this particular ARN prefix - but I'm wondering if there's a way to generally match on any prefix. – Jeppe Sep 19 '22 at 08:48
  • I think a simple grep might suffice for that. It would be great if you could give me example of a prefix which you are looking for in which case I might be able to provide you with a better answer. – Varad Karpe Sep 20 '22 at 04:27