user6309798
user6309798

Reputation:

How to use the --profile option with "aws logs" command for the CloudWatch Logs Agent?

After installing the CloudWatchLogs Agent the command

/var/awslogs/bin/aws logs push --config-file /var/awslogs/etc/awslogs.conf --additional-configs-dir /var/awslogs/etc/config

is running on the machine. To use separate credentials for the CloudWatchLogs Agent a profile was created in /root/.aws.

Trying to use the profile with

/var/awslogs/bin/aws logs push --config-file /var/awslogs/etc/awslogs.conf --additional-configs-dir /var/awslogs/etc/config --profile awslogs

throws an error

aws: error: argument operation: Invalid choice, valid choices are ...

Upvotes: 1

Views: 786

Answers (2)

eis
eis

Reputation: 53553

You would use it in the beginning:

/var/awslogs/bin/aws --profile awslogs logs push ...

Upvotes: 0

user20871228
user20871228

Reputation: 1

export AWS_PROFILE=user1 can be used for Linux and you can omit --profile in aws cli command.

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html

Upvotes: 0

Related Questions