# AWS\_SECRET\_KEY I need to rstrip('/r') on ubuntu or I get an error

**URL:** <https://forum.ansible.com/t/aws-secret-key-i-need-to-rstrip-r-on-ubuntu-or-i-get-an-error/17293>\
**Category:** Ansible Project\
**Tags:** ubuntu, aws\
**Created:** [January 16, 2015, 2:32pm UTC](https://forum.ansible.com/t/aws-secret-key-i-need-to-rstrip-r-on-ubuntu-or-i-get-an-error/17293 "2015-01-16T14:32:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [January 16, 2015, 2:32pm UTC](https://forum.ansible.com/t/aws-secret-key-i-need-to-rstrip-r-on-ubuntu-or-i-get-an-error/17293/1 "2015-01-16T14:32:53Z")

</div>

I’m on ubuntu 14.04

[(master)] ansible --version  
ansible 1.8.2

If I just define AWS\_SECRET\_KEY,AWS\_ACCESS\_KEY in my bash env,  
I get the following error with all ec2 modules.

boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized

\<?xml version="1.0" encoding="UTF-8"?\>

`AuthFailure`AWS was not able to validate the provided access credentials9ad65772-2754-42ab-901b-ef9153276797

If I add the aws\_access\_key and aws\_secret\_key and lookup the var, I get the same error unless I rstrip(‘\r’) . I discovered the trailing ‘\r’ by running with -vvvv .

group\_vars/all  
aws\_secret\_key: “{{lookup(‘env’,‘AWS\_SECRET\_KEY’).rstrip(‘\r’)}}”  
aws\_access\_key: “{{lookup(‘env’,‘AWS\_ACCESS\_KEY’).rstrip(‘\r’)}}”

task I am running.

- route53:  
aws\_access\_key: “{{aws\_access\_key}}”  
aws\_secret\_key: “{{aws\_secret\_key}}”  
command: create  
zone: “{{aws\_vpc.zone}}”  
record: [my-record.org](http://my-record.org)  
type: A  
ttl: 7200  
value: 1.1.1.1,2.2.2.2,3.3.3.3

Am I doing something wrong, or is this something I should make a bug report for?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 16, 2015, 2:35pm UTC](https://forum.ansible.com/t/aws-secret-key-i-need-to-rstrip-r-on-ubuntu-or-i-get-an-error/17293/2 "2015-01-16T14:35:53Z")

</div>

I'm guessing you copied the key from a windows machine?

---

<div class="post-metadata">

**Author:** ![Kesten\_Broughton2](https://avatars.discourse-cdn.com/v4/letter/k/ecc23a/32.png) [@Kesten\_Broughton2](https://forum.ansible.com/u/Kesten_Broughton2)\
**Post date:** [January 21, 2015, 2:40pm UTC](https://forum.ansible.com/t/aws-secret-key-i-need-to-rstrip-r-on-ubuntu-or-i-get-an-error/17293/3 "2015-01-21T14:40:19Z")

</div>

Hi Brian,  
Actually, no windows machine involved.  
I just go to the AWS manage keys and download the credentials.csv.  
Then copied and pased into an aws.ini file.

I was using an ubuntu 14.04 machine.  
I’ll see if i can reproduce on my mac.

k
