1

My question has two parts: - How to get log events? The command line tells me that I need to configure aws... - How to configure aws?

I try to get log events by doing the following:

sudo aws logs get-log-events --log-group-name my-group --log-stream-name my-stream --region us-west-2

But I get the error Unable to locate credentials. You can configure credentials by running "aws configure".

So, that is exactly what I do. I run aws configure, and I fill in the fields as appropriate:

AWS Access Key ID [****************NEEA]: 
AWS Secret Access Key [****************Ta1a]: 
Default region name [us-west-2]: 
Default output format [json]: 

Howevever, I try again to get log events: sudo aws logs get-log-events --log-group-name my-group --log-stream-name my-stream --region us-west-2, and the same error results.

How do I solve this problem?

1 Answer 1

2

According to your snippets, you are running the AWS Command Line Interface (AWS CLI) via sudo, i.e.:

sudo aws logs get-log-events --log-group-name my-group --log-stream-name my-stream --region us-west-2

However, you seem to configure the AWS CLI itself without using sudo, i.e. just:

aws configure

This will store the credentials in the current users home directory, rather than the one of the root user - accordingly, you can fix this by either running the actual aws logs commands without sudo too, or configure AWS credentials for the root user as well, e.g.:

sudo aws configure

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .