Aws-cli: Make user-agent string used by aws cli configurable

Created on 6 Mar 2019  路  2Comments  路  Source: aws/aws-cli

One can query cloud trail for all requests to a given api and it lists the user agent string that the call was made in. This allows one to discover who might be abusing api calls and contributing to api throttling. But there's no way to separate any aws cli commands. They all get the same user agent string that is set in this part of the code (as far as I'm aware): https://github.com/aws/aws-cli/blob/648637cb5a09e71a99577a58bf967038ace2943c/awscli/clidriver.py#L73-L76

Can part of the user agent string be configurable as an input to a given request or in the aws config file somewhere? It would allow customers who share accounts with multiple teams in a given company to separate out who is really making all those calls to a given API.

This can be configured when using the aws sdk but not in the aws cli.

Thank you,
-Asaf

configuration feature-request

Most helpful comment

Hi:
This might be a little late but just for future people who are looking for ways to set userAgent by just configuring environment variables but not changing the code, one can set the AWS_EXECUTION_ENV env variable to let that appear in the userAgent. Take a look at here:

https://github.com/boto/botocore/blob/develop/botocore/session.py#L431

Hope this helps!

All 2 comments

@asaf-erlich - Thank you for you post. This is a reasonable feature request and marking it as such pending further review.

Hi:
This might be a little late but just for future people who are looking for ways to set userAgent by just configuring environment variables but not changing the code, one can set the AWS_EXECUTION_ENV env variable to let that appear in the userAgent. Take a look at here:

https://github.com/boto/botocore/blob/develop/botocore/session.py#L431

Hope this helps!

Was this page helpful?
0 / 5 - 0 ratings