title: ec2_instance_facts botocore.exceptions.NoCredentialsError: Unable to locate credentials
body: <p>When I'm trying to run my ansible playbook towards my EC2 machine on AWS &amp; collect some facts using ec2_instance_facts module. I'm getting the following error: </p>
  
  <pre><code>botocore.exceptions.NoCredentialsError: Unable to locate credentials
  </code></pre>
  
  <p><strong>Aws CLI:</strong> </p>
  
  <pre><code>[ansible@control aws]$ aws --version
  aws-cli/1.16.81 Python/2.7.5 Linux/3.10.0-862.el7.x86_64 botocore/1.12.71
  </code></pre>
  
  <p><strong>Ansible:</strong> </p>
  
  <pre><code>[ansible@control aws]$ ansible --version
  ansible 2.7.5
    config file = /etc/ansible/ansible.cfg
    configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
    ansible python module location = /usr/lib/python2.7/site-packages/ansible
    executable location = /bin/ansible
    python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
  [ansible@control aws]$
  </code></pre>
  
  <p>I did add my credentials using aws configure</p>
  
  <pre><code>[ansible@control aws]$ aws configure
  AWS Access Key ID [****************SGWA]:
  AWS Secret Access Key [****************kZwS]:
  Default region name [ca-central]:
  Default output format [None]:
  [ansible@control aws]$
  </code></pre>
  
  <p>and it's getting saved properly: </p>
  
  <pre><code>[ansible@control aws]$ aws configure list
        Name                    Value             Type    Location
        ----                    -----             ----    --------
     profile                &lt;not set&gt;             None    None
  access_key     ****************SGWA shared-credentials-file
  secret_key     ****************kZwS shared-credentials-file
      region               ca-central              env    AWS_DEFAULT_REGION
  </code></pre>
  
  <p>I checked credentials</p>
  
  <pre><code>ansible@control .aws]$ cat credentials
      [default]
      aws_access_key_id = **********************GWA
      aws_secret_access_key = ***************************kZwS
  </code></pre>
  
  <p>I also checked config</p>
  
  <pre><code>[ansible@control .aws]$ cat config
  [default]
  region = ca-central
  </code></pre>
  
  <p>My account ansible has <code>AmazonEC2FullAccess</code> </p>
  
  <p>Not quite sure what I'm missing here! Any ideas? </p>
  
  <p>Thanks </p>