# Ansible Cloud Module

**URL:** <https://forum.ansible.com/t/ansible-cloud-module/23383>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [January 4, 2017, 10:54pm UTC](https://forum.ansible.com/t/ansible-cloud-module/23383 "2017-01-04T22:54:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shyam\_Yenna](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Shyam\_Yenna](https://forum.ansible.com/u/Shyam_Yenna)\
**Post date:** [January 4, 2017, 10:54pm UTC](https://forum.ansible.com/t/ansible-cloud-module/23383/1 "2017-01-04T22:54:59Z")

</div>

I am trying to create a role for aws vpc creation. one of the task is to create an elastic ip address and associate that ip address to nat gateway instance. if i run multiple times playbook it is recreating elastic ip but i would like to find a viable solution to make it idempotent. Please can you let me know if any solution. I appreciate your feeedback.

ec2\_eip and ec2\_vpc\_nat\_gateway modules is been used.

Sample code:

- name: Create elastic ip for NAT Gateway  
ec2\_eip:  
region: “{{ region }}”  
state: “present”  
register: ec2\_eip

- name: Create NAT Gateway  
ec2\_vpc\_nat\_gateway:  
state: “present”  
if\_exist\_do\_not\_create: “true”  
allocation\_id: “{{ ec2\_eip.allocation\_id }}”  
region: “{{ region }}”

Thanks in Advance
