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
Discord
online
Get help straight from the Payload team with an Enterprise License.