duckdb / duckdb_aws

MIT License
34 stars 12 forks source link

Add support for setting the region + update duckdb #8

Closed samansmink closed 10 months ago

samansmink commented 10 months ago

This PR adds support for also setting the s3 region automatically. Additionally, it updates the submodule.

With this PR default behaviour of the load_aws_credentials() call now also uses the aws sdk to fetch the region either from the config file or the AWS_DEFAULT_REGION env variable.

Also wanted to fetch the endpoint which the aws cli can now parse from the config file or env var, but that appears to be not yet supported: https://github.com/aws/aws-sdk-cpp/issues/2587

With this PR, you are able to set up multiple profiles with different credentials and regions in your ~/.aws/config and easily switch between them.

stephaniewang526 commented 10 months ago

Thanks for the fix! A general question regarding where credentials are extracted.. I assume this continues to work for creds saved in ~/.aws/credentials, right? And those will take precedence over creds saved in ~/.aws/config? Does this extract tokens also from ~/.aws/cli/cache (for shared profiles and temporary credentials) -- does cache take precedence over /credentials?

@carlopi Could you advise whether this works in duckdb-wasm? A desirable workflow is user loads the AWS extension in browser, calls load_credentials tf, and boom it just works when they read S3 files.

carlopi commented 10 months ago

@carlopi Could you advise whether this works in duckdb-wasm? A desirable workflow is user loads the AWS extension in browser, calls load_credentials tf, and boom it just works when they read S3 files.

@stephaniewang526: This will not work as is in duckdb-wasm, and a replacement behaviour might be desirable where a call to load_aws_credentials becomes an hook for some other sort of alternative behaviour in duckdb-wasm

stephaniewang526 commented 10 months ago

@carlopi Could you advise whether this works in duckdb-wasm? A desirable workflow is user loads the AWS extension in browser, calls load_credentials tf, and boom it just works when they read S3 files.

@stephaniewang526: This will not work as is in duckdb-wasm, and a replacement behaviour might be desirable where a call to load_aws_credentials becomes an hook for some other sort of alternative behaviour in duckdb-wasm

Thank you for the information. To double-check, if the user provides their credentials through the SET commands in browser (which sets them in DBConfig) then that should be available through select * from duckdb_settings() right?

carlopi commented 10 months ago

To double-check, if the user provides their credentials through the SET commands in browser (which sets them in DBConfig) then that should be available through select * from duckdb_settings() right?

On that should behave the same as duckdb CLI.