pythonamazon-web-services

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?


Solution

  • 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
    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...