A filter in python terms is a list of maps, and each value in the map’s key-value pairs can be a list. The documentation is a little light on details, intentionally I believe, because the format is extremely flexible. A few examples of using this in Python and Powershell are below
If you wanted to get all of the instances that have a Name tag with the value webserver, you would use
filters = [{‘Name’:’tag:Name’, ‘Values’: [‘*Webserver*’]}]
Here is an example of using this concept in a python script:
https://gist.github.com/LenOtuye/ed4617b19217a3f903dc0161524dcd91.js
And here is the same thing in powershell. https://gist.github.com/LenOtuye/c7c36710be9a153ea1998045c64806a9.js
And just for extra fun, once you have the instance objects in Powershell it’s pretty easy to pipe them to other commandlets, like “where” to filter by instance type: https://gist.github.com/LenOtuye/71d800f6807bda0d501a157ec6a50757.js