Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Does the db-postgres plugin support IAM authentication for AWS RDS PostgreSQL?

default discord avatar
ash26_8 months ago

I am looking for a way to refresh the AWS IAM authentication tokens that are used as the password for an RDS database connection. This auth method is a security requirement in my company.



I am able to generate the token and connect to the RDS database in AWS but after 15 minutes the token expires. This is expected per AWS docs. Apps are expected to then refresh that token the next time they attempt to connect.



Is there a way to do this with the plugin?



Maybe I can modify the payload.db.connect function? Or create a hook to generate new credentials before a new connection attempt or on connection failure?



Ok so it was pretty simple. You can just pass a function as the password! The function regenerates the token and just returns a string.



Payload is using Drizzle with node-postgres as the postgres client so on node-postgres documentation it mentions gow to connect with an RDS database.

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team..