Retrieving list of available VPCs and available Subnets via AWS dynamic inventory

I have VPC with number of subnets in it which (vpc and subnets) are tagged in a particular way what would give me a way to retrieve a particular subnet that I want to use to launch ec2 instance (using ansible ec2 module).

How do I do that? Should I record subnet and vpc ids in some way in file to use them later on? What would be a best practice in this case?