redash icon indicating copy to clipboard operation
redash copied to clipboard

Support AWS RDS IAM Authentication for Redash database

Open winebarrel opened this issue 10 months ago • 0 comments

What type of PR is this?

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] New Query Runner (Data Source)
  • [ ] New Alert Destination
  • [ ] Other

Description

If you are using AWS RDS as your Redash database, enable IAM authentication. Setting environment variable REDASH_DATABASE_IAM_AUTH to true enables IAM authentication

How is this tested?

  • [ ] Unit tests (pytest, jest)
  • [ ] E2E Tests (Cypress)
  • [x] Manually
  • [ ] N/A

I created a PostgreSQL (Aurora) instance on AWS RDS and confirmed that I can connect to the DB using IAM authentication from Redash in docker compose with the following settings.:

REDASH_DATABASE_URL=postgresql://[email protected]:5432/postgres
AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=xxx
AWS_DEFAULT_REGION=ap-northeast-1
REDASH_DATABASE_IAM_AUTH=true

redash role used to connect is granted rds_iam role.

postgres=> SELECT r.rolname as username,r1.rolname as "role"
postgres-> FROM pg_catalog.pg_roles r JOIN pg_catalog.pg_auth_members m
postgres-> ON (m.member = r.oid)
postgres-> JOIN pg_roles r1 ON (m.roleid=r1.oid)
postgres-> WHERE r.rolcanlogin
postgres-> ORDER BY 1;
 username |     role
----------+---------------
 postgres | rds_superuser
 redash   | rds_superuser
 redash   | rds_iam

Related Tickets & Documents

N/A

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

N/A

winebarrel avatar Jan 31 '25 16:01 winebarrel