Skip to content

Support setting profile, provider, and chain for RDS IAM authentication #464

@kinghuang

Description

@kinghuang

What happens?

#457 added support for RDS IAM authentication, where the database password comes from calling the GenerateRDSAuthToken API. However, there's no parameters like profile, provider, and chain to set the underlying credentials used to call the API, like with S3 secrets. Only the default credentials provider chain and values in AWS_PROFILE, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY environment variables are supported. I am unable to configure the postgres secret to work with my AWS config.

To Reproduce

  1. Have a local AWS profile that uses SSO sessions. Set that profile as the AWS_PROFILE environment variable.
  2. Create a postgres secret for an RDS/Aurora instance with IAM-based authentication enable with aws_rds_iam_auth_enabled true.
  3. Attempt to attach to the PostgreSQL instance.

Example statements using the README values to hide connection details.

create or replace secret rds_secret (
  type postgres,
  host 'my-db-instance.xxxxxx.us-west-2.rds.amazonaws.com',
  port 5432,
  database 'postgres',
  user 'my_iam_user',
  aws_rds_iam_auth_enabled true,
  aws_region 'us-west-2'
);

attach '' as rds_db (type postgres, secret rds_secret);

An IO Error occurs.

IO Error: Unable to connect to Postgres at "": connection to server at "my-db-instance.xxxxxx.us-west-2.rds.amazonaws.com" (10.x.x.x), port 5432 failed: fe_sendauth: no password supplied

With S3 secrets, I typically set the chain to 'env;sso to work with my AWS profiles.

create or replace secret s3 (
  type s3,
  provider credential_chain,
  chain 'env;sso',
  …
);

OS:

macOS

PostgreSQL Version:

17.5

DuckDB Version:

1.5.2

DuckDB Client:

DuckDB

Full Name:

King Chung Huang

Affiliation:

SensorUp

Have you tried this on the latest main branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions