Support AWS RDS IAM Authentication for PostgreSQL data soruce - #7695
Open
winebarrel wants to merge 5 commits into
Open
winebarrel wants to merge 5 commits into
winebarrel wants to merge 5 commits into
Conversation
winebarrel
force-pushed
the
support-rds-iam-auth-for-data-source
branch
from
April 18, 2026 03:50
9a6df85 to
581975f
Compare
…urce) - upstream migrated Poetry -> uv (removed poetry.lock, added uv.lock) - moved boto3/botocore from all_ds group to main [project].dependencies - regenerated uv.lock
Greptile SummaryThis PR adds AWS RDS IAM authentication as an optional feature for the PostgreSQL query runner, allowing operators to connect using short-lived IAM tokens instead of a static password. The implementation is straightforward and follows the pattern already established by
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| redash/query_runner/pg.py | Adds AWS RDS IAM authentication support to the PostgreSQL runner: new awsIamAuth/awsRegion config fields, a try/except ImportError guard for boto3, and token generation in _get_connection. The token is freshly generated per query (connection is closed in finally), so the 15-minute expiry is not an issue. Minor: CockroachDB inherits the IAM fields from PostgreSQL without override. |
| uv.lock | Version bump only: redash package version incremented from 26.7.0.dev0 to 26.8.0.dev0. No dependency graph changes visible in this diff hunk. |
Sequence Diagram
sequenceDiagram
participant RQ as run_query()
participant GC as _get_connection()
participant BOTO as boto3 RDS client
participant PG as psycopg2 / RDS PostgreSQL
RQ->>GC: call
GC->>GC: _get_ssl_config() / _parse_dsn()
alt "awsIamAuth == True"
GC->>BOTO: "client("rds", region_name=awsRegion)"
BOTO-->>GC: rds_client
GC->>BOTO: generate_db_auth_token(host, port, user)
BOTO-->>GC: auth_token (valid 15 min)
GC->>GC: "password = auth_token"
else "awsIamAuth == False"
GC->>GC: "password = configured password"
end
GC->>PG: psycopg2.connect(user, password, host, port, dbname, ssl_config)
PG-->>GC: "connection (async_=True)"
GC-->>RQ: connection
RQ->>PG: cursor.execute(query)
RQ->>PG: connection.close() [finally block]
Reviews (5): Last reviewed commit: "Merge branch 'master' into support-rds-i..." | Re-trigger Greptile
Keep boto3/botocore in the optional all_ds group instead of promoting them to top-level dependencies. Restore the guarded boto3 import (IAM_ENABLED) and make RedshiftIAM.enabled() depend on it again, and raise a clear error if awsIamAuth is used without boto3 installed.
winebarrel
force-pushed
the
support-rds-iam-auth-for-data-source
branch
from
August 1, 2026 07:50
15e9548 to
2f3f360
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Description
Enable IAM authentication for connecting to AWS RDS in PostgreSQL data source.
see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html
Using IAM authentication allows you to connect to the database more securely than with password authentication.
How is this tested?
I added the following settings and confirmed that I could connect to the RDS for testing.
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)