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

**URL:** <https://forum.ansible.com/t/retrieving-list-of-available-vpcs-and-available-subnets-via-aws-dynamic-inventory/17980>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [April 15, 2015, 6:24am UTC](https://forum.ansible.com/t/retrieving-list-of-available-vpcs-and-available-subnets-via-aws-dynamic-inventory/17980 "2015-04-15T06:24:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rihards](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@Rihards](https://forum.ansible.com/u/Rihards)\
**Post date:** [April 15, 2015, 6:24am UTC](https://forum.ansible.com/t/retrieving-list-of-available-vpcs-and-available-subnets-via-aws-dynamic-inventory/17980/1 "2015-04-15T06:24:21Z")

</div>

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?
