AWS – NoCredentialsError: Unable to locate credentials

Question:

I’m new in AWS also a beginner in python.

I have situation in here,I’m facing this kind of 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 need to check?
Please advice.

Asked By: Zeee

||

Answers:

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

in a folder named .aws in your home directory.

Answered By: Marcin

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"
.
2)Re-install cloudwatch agent services at server "sudo yum install -y awslogs"
.
3)Reconfigure cloudwatch config files steps
https://youtu.be/22lzkpra_WU

Issue solved…thanks everyone…

Answered By: Zeee
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.