# ec2\_instance vs ec2 - which one to use & and is there a plan?

**URL:** <https://forum.ansible.com/t/ec2-instance-vs-ec2-which-one-to-use-and-is-there-a-plan/29976>\
**Category:** Ansible Project\
**Created:** [March 25, 2019, 3:33pm UTC](https://forum.ansible.com/t/ec2-instance-vs-ec2-which-one-to-use-and-is-there-a-plan/29976 "2019-03-25T15:33:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [March 25, 2019, 3:33pm UTC](https://forum.ansible.com/t/ec2-instance-vs-ec2-which-one-to-use-and-is-there-a-plan/29976/1 "2019-03-25T15:33:36Z")

</div>

Hi

While trying to debug some issues (notably trying to add several security groups to an EC2 instance), I once again ran into the question about which ansible module to use to for EC2 instances.

From the docs it appears that both the ec2 and the ec2\_instance module are supported, with the latter being the newest, and they do largely the same things.  
I’ve shuffled around the ec2\_instance task into an ec2 task, and I was able to get that to work with multiple security groups.  
But now I’m having a hard time getting this new ec2 task to be idempotent, and also the way that IP addresses are assigned is more limited than ec2\_instance.

I’m wary of picking the “old” ec2 module for my tasks, or mixing the two, because I suspect ec2 might get deprecated some time soon in favor of the ec2\_instance module.

I couldn’t find any statement or road map on this topic - is there a long term plan or a road map wrt the two EC2 modules? If so, I can at least make a sound decision on where to spend energy, also in terms of fixing issues.

thx

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [March 26, 2019, 3:07am UTC](https://forum.ansible.com/t/ec2-instance-vs-ec2-which-one-to-use-and-is-there-a-plan/29976/2 "2019-03-26T03:07:24Z")

</div>

You can get an idempotent ec2 task using the instance\_tags, exact\_count, and count\_tag options. The IP addresses are more limited because the module uses the old boto library which is no longer actively maintained by AWS.

I’m not aware of any plans to deprecate the ec2 module in the near future. The ec2\_instance module is preview status as there are still some things to be fixed, like you’ve found.

I think the current state of things is that features can be added to ec2\_instance, but not ec2 (we try to avoid adding more boto-dependent code). The ec2 module can still receive bug fixes, but since it uses the boto library which isn’t getting patched for its own bugs or updated with features there are issues that won’t be able to be resolved in that module. Those problems can be fixed in ec2\_instance since that module uses boto3.
