brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
598 stars 227 forks source link

No support for AWS_CONFIG_FILE, AWS_SHARED_CREDENTIALS_FILE #948

Closed flokli closed 1 year ago

flokli commented 1 year ago

I have $AWS_CONFIG_FILE pointing to another location than ~/.aws/config, but it seems amazonka isn't picking up that location.

flokli commented 1 year ago

It also looks like it's not supporting AWS_SHARED_CREDENTIALS_FILE, and skipping config files alltogether if there's no ~/.aws/credentials file around (even though it's not necessary for SSO-style logins)

flokli commented 1 year ago

I was able to workaround this by copying my file from $AWS_CONFIG_FILE to ~/.aws/config, and creating an empty ~/.aws/credentials file.

arianvp commented 1 year ago

Sounds like we should make the Credentials file optional. Small fix

endgame commented 1 year ago

Does a description exist in an AWS SDK manual of what correct behaviour should look like? If not, maybe there's a clear link inside one of the SDK repos which we can reference?

And for a potential workaround: you don't have to use discover, you can use the other functions in Amazonka.Auth to find credentials in any way you please.

flokli commented 1 year ago

https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html#credentialProviderChain describes the order of different credential types.

It also links to https://docs.aws.amazon.com/sdkref/latest/guide/settings-reference.html#EVarSettings, which at least describes all the different env vars that are available. Might be one needs to dive into a specific other SDK to get the details right, but having amazonka behave differently than other SDKs is confusing.

arianvp commented 1 year ago

https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config@v1.18.28#EnvConfig is how the official Go SDK does it. which is in line with this issue.

arianvp commented 1 year ago

I'm happy to send a PR to implement this behaviour

endgame commented 1 year ago

That would be excellent. I recommend starting by reading under lib/amazonka/src/Amazonka/Auth/*, hopefully you shouldn't have to get too far into the weeds to understand that.

arianvp commented 1 year ago

Also just random drive-by. Thanks for reviving this project. Seems you put a lot of effort in the 2.0 release. Do you have a way I can send some love your way @endgame ? You do not seem to have Github Sponsors set up.

endgame commented 1 year ago

Thank you, it was a lot hard work. While a good chunk of the 2.0 revival was done in my personal time, many of the meatier features in 2.0 RC 2 (fixing the generator's handling of recursive shape definitions, the hooks system, the authentication rewrite) were done on my employer's time, with their blessing. I don't think it would be appropriate for me to take money for that, so I would instead suggest paying it forward: support someone else working on a load-bearing project who isn't as lucky as I am.