Database Sign-In with AWS IAM
People who sign in to Simcha DB Studio with OpenID Connect can connect from the IDE to Amazon RDS and Aurora databases (PostgreSQL, MySQL, MariaDB) as their own database user with no database password stored: the IDE makes a short-lived RDS authentication token from their sign-in each time it opens a connection. SAML and LDAP sign-ins carry no token AWS accepts, so they use passwords.
How it works
- At OpenID Connect sign-in the server keeps the person's ID token, encrypted, until it expires. Signing out forgets it.
- The DB DevOps connection to the database allows it: IDE Sign-In set to AWS IAM, with the Role People Assume and, when the host is not an RDS host name, the AWS Region. Its own deployment login is unchanged and is never used by the IDE.
- The person adds the connection in the IDE and, in Edit Connection, picks Sign In With: My single sign-on identity (AWS IAM) and enters their database user name. No password is kept.
- On connect the server assumes the role with the person's ID token (
AssumeRoleWithWebIdentity, session name the person's email) and signs an RDS authentication token for their database user, over TLS. A PostgreSQL pool asks for a fresh token for each new connection; other engines reopen within 15 minutes. - When the ID token has expired, connecting answers
IDENTITY_SIGN_IN_NEEDED: sign in again with single sign-on.
AWS setup
- An IAM OpenID Connect identity provider for the same issuer and client ID as Simcha DB Studio's OpenID Connect settings.
- A role whose trust policy allows
sts:AssumeRoleWithWebIdentityfrom that provider withaudequal to the client ID, and whose policy allowsrds-db:connectonarn:aws:rds-db:<region>:<account>:dbuser:<resource id>/<database user>for the users people sign in as. - IAM database authentication turned on for the instance or cluster, and each person's database user created for it:
CREATE USER jdoe; GRANT rds_iam TO jdoe;on PostgreSQL,CREATE USER jdoe IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';on MySQL and MariaDB. Grant each user only what that person may do.
The Audit Log records each IDE query with the person and the database user (databaseLogin); the database's own logs show the same user.