Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AWS default credential provider chain #4021

Closed
2 tasks done
tekumara opened this issue Jul 3, 2022 · 5 comments
Closed
2 tasks done

Support AWS default credential provider chain #4021

tekumara opened this issue Jul 3, 2022 · 5 comments
Assignees

Comments

@tekumara
Copy link

tekumara commented Jul 3, 2022

What happens?

To use S3 (via the HTTPFS extension) requires explicitly setting AWS credentials, eg:

SET s3_region='ap-southeast-2';
SET s3_access_key_id='.....';
SET s3_secret_access_key='....';
SET s3_session_token='....';

The AWS CLI and SDK has a default credential provider chain that will automatically use environment variables if present, or the EC2 metadata endpoint, etc. This removes the need to explicitly provide credentials to applications.

If would be nice if DuckDB could implement the default credentials provider chain (or at least source credentials from environment variables) so that credentials do not need to be explicitly provided.

To Reproduce

eg: from an EC2 instance try accessing an S3 dataset without explicitly providing credentials:

$ duckdb
v0.4.0 da9ee490d
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D INSTALL httpfs;
D LOAD httpfs;
D SELECT * FROM parquet_schema('s3://topsecret/0000_part_00.parquet');
Error: Unable to connect to URL "s3://topsecret/0000_part_00.parquet'": 403 (Forbidden)

Environment (please complete the following information):

  • OS: linux
  • DuckDB Version: v0.4.0 da9ee49
  • DuckDB Client: CLI

Identity Disclosure:

  • Full Name: Oliver Mannion
  • Affiliation: Xero

If the above is not given and is not obvious from your GitHub profile page, we might close your issue without further review. Please refer to the reasoning behind this rule if you have questions.

Before Submitting

  • Have you tried this on the latest master branch?
  • Python: pip install duckdb --upgrade --pre
  • R: install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
  • Other Platforms: You can find binaries here or compile from source.
  • Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
satotake added a commit to satotake/duckdb that referenced this issue Nov 20, 2022
- Support AWS environment variables
    - AWS_DEFAULT_REGION
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - AWS_SESSION_TOKEN
- issue duckdb#4021
satotake added a commit to satotake/duckdb that referenced this issue Dec 2, 2022
- Support AWS environment variables
    - AWS_DEFAULT_REGION
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - AWS_SESSION_TOKEN
- issue duckdb#4021
@samansmink samansmink self-assigned this Mar 10, 2023
@mdagost
Copy link

mdagost commented Mar 24, 2023

This would be super useful for using DuckDB inside of apps running on kubernetes that get their AWS credentials via service accounts.

@slotrans
Copy link

Can't overstate how important this is! It's vital that any tool that talks to AWS use the Default Credentials Provider Chain and prefer that over explicit credentials.

@xerial
Copy link

xerial commented Jun 1, 2023

If profile (or instance profile) authentication is used, the profile name also should be able to be set from duckdb or an environment variable. AWS SDK often has such configurations. Here is an example of the Java version of AWS SDK's default credential provider:

https://github.com/aws/aws-sdk-java-v2/blob/a95b16ea35a6b74ec5c9c471eeefb146f96da82c/core/auth/src/main/java/software/amazon/awssdk/auth/credentials/DefaultCredentialsProvider.java#L92-L109

@samansmink
Copy link
Contributor

This is now supported in nightly builds and the upcoming release through the AWS extension: https://github.com/duckdblabs/duckdb_aws. I'll close this issue for now, if there are any issues or missing features, feel free to open an issue in the aws extension repo!

@xerial
Copy link

xerial commented Jul 18, 2023

@samansmink Great work! Thanks for creating this extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants