'Sequelize with AWS RDS Proxy

I am trying to use the AWS RDS Proxy on my lambda to proxy our database (Aurora MySQL). I wasn't able to find any specific instructions for Sequelize, but it seemed like all I needed for RDS proxy to work is to create a signer, use it to get my token and then pass in the token as my password to the Sequelize constructor:

const signer = new RDS.Signer({
  region: process.env.REGION,
  hostname: process.env.DB_PROXY_ENDPOINT,
  port: 3306,
  username: process.env.DB_PROXY_USERNAME,
});

const token = signer.getAuthToken({
  username: process.env.DB_PROXY_USERNAME,
});

const connection = new Sequelize(process.env.DB_DATABASE, process.env.DB_PROXY_USERNAME, token, {
  dialect: 'mysql',
  host: process.env.DB_HOSTNAME,
  port: process.env.DB_PORT,
  pool: {
    acquire: 15000,
    idle: 9000,
    max: 10
  },
});

The RDS proxy is attached to my lambda and I'm able to log the token, but as soon as I make a request against the database, my connection times out. Does anyone know if there is something I could be missing in this setup?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source