Zeee
Zeee

Reputation: 1

AWS - NoCredentialsError: Unable to locate credentials

I'm facing this issue:

The NoCredentialsError is an error encountered when using the Boto3 library to 
interface with Amazon Web Services (AWS).Specifically, this error is encountered 
when your AWS credentials are missing, invalid, or cannot be located by your Python 
script. 

File "/usr/lib/python2.7/site-packages/botocore/auth.py", line 373, in add_auth
   raise NoCredentialsError()
NoCredentialsError: Unable to locate credentials

And i did some troubleshooting by checking the path given and the credentials is in there.

[root@xxxxxx aws\]# ls  
config  credentials  

Which part am i missing and where else do I need to check?

Upvotes: 0

Views: 2650

Answers (2)

Zeee
Zeee

Reputation: 1

I notice the error happen because of python are unable to communicate with aws api. What i do to settle this issue is:

  1. Python version conflict - got 2 version at server which is 3.7 & 2.7
  • AWS API so far not support python 3
  • Solution: Remove python yum remove python3
  1. Re-install cloudwatch agent services at server sudo yum install -y awslogs

  2. Reconfigure cloudwatch config files steps https://youtu.be/22lzkpra_WU

Issue solved...

Upvotes: 0

Marcin
Marcin

Reputation: 238957

The correct path is ~/.aws, not ~/aws. Please double check your setup with aws docs:

in a folder named .aws in your home directory.

Upvotes: 2

Related Questions