aws / aws-sdk-java-v2

The official AWS SDK for Java - Version 2
Apache License 2.0
2.21k stars 853 forks source link

Support for setting UserAgent Prefix through environment variable #4162

Open muthurajr opened 1 year ago

muthurajr commented 1 year ago

Describe the feature

We are looking at options to prefix UserAgent for s3 client from sdk's. One possible option is change every code like below. This option works but it comes with the risk and time consumption of changing every microservice connecting to s3.

AWSCredentials credentials;
ClientConfiguration conf = new ClientConfiguration()
    .withUserAgentPrefix("APN/1.0 PARTNER/1.0 PRODUCT/1.0");
AmazonS3Client client = new AmazonS3Client(credentials, conf);

Recently, environment variable based user agent setting is introduced in python and ruby SDK's https://github.com/boto/botocore/pull/2955 It would be helpful to implement similar feature in the Java sdk as well.

Use Case

Flexibility to inject User Agent in the existing apps through environment variable, and sync the feature with other language sdk's.

Proposed Solution

https://github.com/boto/botocore/pull/2955

Other Information

No response

Acknowledgements

AWS Java SDK version used

latest 2.20.98

JDK version used

17.0.7

Operating System and version

alpine 3.18 (latest)

debora-ito commented 1 year ago

Request acknowledged. Thank you for reaching out.

johnosam commented 5 months ago

Hi @debora-ito, I am also interested in this feature. Our use case is auditing EMR Spark s3 usage by injecting meta data into UserAgent.