# using ansible on aws, then get the IP address of the aws instances.

**URL:** <https://forum.ansible.com/t/using-ansible-on-aws-then-get-the-ip-address-of-the-aws-instances/22775>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 12, 2016, 12:17am UTC](https://forum.ansible.com/t/using-ansible-on-aws-then-get-the-ip-address-of-the-aws-instances/22775 "2016-10-12T00:17:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Smith](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@John\_Smith](https://forum.ansible.com/u/John_Smith)\
**Post date:** [October 12, 2016, 12:17am UTC](https://forum.ansible.com/t/using-ansible-on-aws-then-get-the-ip-address-of-the-aws-instances/22775/1 "2016-10-12T00:17:16Z")

</div>

I have an ansible playbook that starts up some aws instances. once they are up I can see the instances have  
public ip and private ip.

is there a way I can programmatically get the ip addresses from outside aws cliud instead of of having to look at the aws console ?

I want my application (teamcity, run on linux) outside of aws to call the ansible playbook, start up the instances, then when  
they are up I need a way to go get the ip addresses of the instances that have been brought up in aws.

has anyone done anything like this ?

---

<div class="post-metadata">

**Author:** ![Allen\_Sanabria1](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Allen\_Sanabria1](https://forum.ansible.com/u/Allen_Sanabria1)\
**Post date:** [October 13, 2016, 3:13pm UTC](https://forum.ansible.com/t/using-ansible-on-aws-then-get-the-ip-address-of-the-aws-instances/22775/2 "2016-10-13T15:13:58Z")

</div>

It depends on how you want to approach this.

1st approach: You can use the [ec2.py inventory generator](http://docs.ansible.com/ansible/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script).  
2nd approach: You can write Ansible Filters to get inventory dynamically during the same playbook run. Here is an example of [Filter that I have written for AWS](https://github.com/linuxdynasty/ld-ansible-filter-plugins).
