hrbrmstr / metis

Helpers for Accessing and Querying Amazon Athena using R, Including a lightweight RJDBC shim
Other
16 stars 2 forks source link

Use the default provider chain #3

Closed dabdine-r7 closed 6 years ago

dabdine-r7 commented 6 years ago

Most AWS integration (boto, cli, etc.) uses the Default AWS Credential Provider Chain (https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html). This simply steps through a number of authentication methods to pull AWS access keys.

The current version of metis uses a combination of EnvironmentVariableCredentialsProvider and aws.signature to load credentials. While this is great, since, this R package is based on Rjava, and Rjava loads the Java environment up once when it's initialized, keys cannot be changed without re-initializing Rjava. For RStudio, I've had to quit and re-enter to update keys. This is particularly problematic for situations where temporary access tokens are used.

This simple fix just delegates back to Java to make the decision on where to grab keys from. You can still use aws.signature as the docs say today as is. However, you don't have to now, and can benefit from the fallback chain the default provider has.