# Does ansible -m ec2 works ?

**URL:** <https://forum.ansible.com/t/does-ansible-m-ec2-works/18212>\
**Category:** Ansible Project\
**Created:** [May 12, 2015, 3:48pm UTC](https://forum.ansible.com/t/does-ansible-m-ec2-works/18212 "2015-05-12T15:48:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [May 12, 2015, 3:48pm UTC](https://forum.ansible.com/t/does-ansible-m-ec2-works/18212/1 "2015-05-12T15:48:33Z")

</div>

Hi,

I would like to launch an ec2 instance the same way you can with chef-knife :

ansible localhost -m ec2 -a “key\_name=test group=qa instance\_type=t2.micro image=ami-aecd60c7 wait=true exact\_count=1 instance\_tags=testing” --connection=local

but I"m getting this error :

“”"

localhost | FAILED \>\> {

“failed”: true,

“msg”: “dictionary requested, could not parse JSON or key=value”

}

“”"

is it possible to use the ec2 module with ansible adhoc or it only works with ansible-playbook ?

---

<div class="post-metadata">

**Author:** ![James\_Cammarata](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@James\_Cammarata](https://forum.ansible.com/u/James_Cammarata)\
**Post date:** [May 12, 2015, 5:05pm UTC](https://forum.ansible.com/t/does-ansible-m-ec2-works/18212/2 "2015-05-12T17:05:55Z")

</div>

Hi Nicolas, that’s an interesting failure, as all modules should work just fine via ad-hoc mode. I’m wondering if there’s some other error occurring here, and it’s simply being caught by that exception handler.

Feel free to open a Github issue for this, but in the mean time you might want to try other options and/or ensure that what you have does not fail when run via a playbook.
