I'm trying to use the CloudWatch logs agent on a RedHat instance with an IAM role attached. The role has full access to CloudWatch. I installed and setup the agent using the instructions here:
Even though the IAM role is definitely attached to the instance, I keep seeing this message in /var/log/awslogs.log:
NoCredentialsError: Unable to locate credentials
When I run aws configure list, I can see the details for the IAM role.
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ******************** iam-role
secret_key ******************** iam-role
region us-east-1 config-file ~/.aws/config
Here is the contents of /var/awslogs/etc/aws.conf.
[plugins]
cwlogs = cwlogs
[default]
region = us-east-1
So why can't the CloudWatch logs agent find and use the IAM role?
Press Enter if using an IAM role. Otherwise, enter your AWS access key ID.- helloV/var/awslogs/etc/aws.conf. If it has entries foraws_access_key_idandaws_secret_access_key, remove them and then restart the agent. - helloV/var/awslogs/etc/aws.confdoesn't containaws_access_key_idoraws_secret_access_key. Edited the OP for clarity. - jcgrowley