# ec2\_tag does not take AWS credential keys from environment variable

**URL:** <https://forum.ansible.com/t/ec2-tag-does-not-take-aws-credential-keys-from-environment-variable/17434>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [February 3, 2015, 3:37pm UTC](https://forum.ansible.com/t/ec2-tag-does-not-take-aws-credential-keys-from-environment-variable/17434 "2015-02-03T15:37:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Bhadani](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pradeep\_Bhadani](https://forum.ansible.com/u/Pradeep_Bhadani)\
**Post date:** [February 3, 2015, 3:37pm UTC](https://forum.ansible.com/t/ec2-tag-does-not-take-aws-credential-keys-from-environment-variable/17434/1 "2015-02-03T15:37:07Z")

</div>

I am trying to use ec2\_tag in my playbook and it failes with Authetication error " No handler was ready to authenticate. 1 handlers were checked. [‘QuerySignatureV2AuthHandler’] Check your credentials".  
I have set my AWS keys with Environment variables with all combination -  
access key : AWS\_ACCESS\_KEY , AWS\_ACCESS\_KEY\_ID , EC2\_ACCESS\_KEY  
secret access key : AWS\_SECRET\_ACCESS\_KEY , AWS\_SECRET\_KEY , EC2\_SECRET\_KEY

However , If i supply my credentials key with ec2\_tag like below , it works:  
ec2\_tag: resource={{ ansible\_ec2\_instance\_id }} region={{ ansible\_ec2\_placement\_region }} state=present **ec2\_access\_key** =XXXXXXXXXXX **ec2\_secret\_key** =XXXXXXXXXXXX

Clearly , it is not good practice pass credentials keys with code.

Does anyone faces same problem or have any clue why its failing?

---

<div class="post-metadata">

**Author:** ![Pradeep\_Bhadani](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pradeep\_Bhadani](https://forum.ansible.com/u/Pradeep_Bhadani)\
**Post date:** [February 3, 2015, 3:48pm UTC](https://forum.ansible.com/t/ec2-tag-does-not-take-aws-credential-keys-from-environment-variable/17434/2 "2015-02-03T15:48:20Z")

</div>

It seems that there is already an open bug : [https://github.com/ansible/ansible/issues/9984](https://github.com/ansible/ansible/issues/9984)

---

<div class="post-metadata">

**Author:** ![vaida.dan](https://avatars.discourse-cdn.com/v4/letter/v/5daacb/32.png) [@vaida.dan](https://forum.ansible.com/u/vaida.dan)\
**Post date:** [February 3, 2015, 5:10pm UTC](https://forum.ansible.com/t/ec2-tag-does-not-take-aws-credential-keys-from-environment-variable/17434/3 "2015-02-03T17:10:25Z")

</div>

Yeah… and if I’m not mistaking the Issue should be created here: [https://github.com/ansible/ansible-modules-core](https://github.com/ansible/ansible-modules-core)
