AWS.RDS.signer + Connection pooling ?
See original GitHub issueI am wondering if you have any suggestions for the following situation:
I would like to use AWS.RDS.signer to generate password tokens for use in a connection pool. I have put together something like the following…
const createPool = () => new Promise((resolve, reject) => {
signer.getAuthToken({
region: '...',
hostname: '...',
port: '...',
username: '...'
}, (err, token) => {
if (err) reject(err)
const pool = mysql.createPool({
host: '...',
port: '...',
user: '...',
database: '...',
password: token,
ssl: 'Amazon RDS'
authSwitchHandler: (data, cb) => {
if (data.pluginName === 'mysql_clear_password') cb(null, Buffer.from(token + '\0'))
}
})
resolve(pool)
})
})
…and it works great – but only for 15 minutes, and then the AWS token expires. At that point new connections cannot be established in the pool.
Is there any way to update the pool config options after the pool has been created, so I can keep the token fresh? Would you perhaps consider letting a function be passed as the password property, so that it can return a dynamic value at the time a connection is created? Otherwise, it really isn’t practical to use the aws signer with connection pooling, as I understand it.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Using Amazon RDS Proxy with AWS Lambda
RDS Proxy helps you manage a large number of connections from Lambda to an RDS database by establishing a warm connection pool to...
Read more >node-mysql2, AWS.RDS.signer, & connection pooling
RDS.signer. I have the following function, which creates a connection pool for reusing connections: const createPool = () ...
Read more >Using AWS RDS Proxy to Pool Database Connections from ...
Connection pooling is when a certain number of database connections are kept alive so that when a request comes in that needs to...
Read more >AWS RDS Proxy w/ IAM Authentication enabled to Aurora SLS ...
Amazon RDS Proxy allows applications to pool and share connections established with the database. In this article, we will see how we can ......
Read more >Introduction to RDS Proxy - YouTube
RDS Proxy is a fully managed database proxy for Amazon Relational Database Service ( RDS ) that makes applications more scalable, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That worked! Thanks. I really appreciate it.
It would be great to have this in documentation.
For my own learning, how does
return () => {
change the response object? Is this a specific structure in ES6?Thanks for the super fast response, and thanks for the extremely helpful advice! That is exactly what I am looking for. Much appreciated.