3

I have

 app.connectionPool = mysql.createPool({
      host     : * * *, //(a.k.a ....rds.amazonaws.com)
      user     : * * *,
      password : * * *,
      database : * * *,
      ssl: 'Amazon RDS'
 });

for initializing the db pool and it works fine locally (where my IP is whitelisted in RDS settings) but gives [Error connect ETIMEOUT] error when run from heroku.

I also tried:

 app.connectionPool = mysql.createPool({
      host     : * * *, // (....rds.amazonaws.com)
      user     : * * *,
      password : * * *,
      database : * * *,
      ssl  : {
        ca : fs.readFileSync(__dirname + '/config/amazon-rds-ca-cert.pem')
      }
});

following node-mysql and heroku docs but didn't work either.

PS: I have set GRANT USAGE ON *.* TO 'my_username'@'%' REQUIRE SSL; as suggested in the heroku documentation.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
sepans
  • 1,372
  • 13
  • 24

1 Answers1

0

I don't know if you are still struggling with this (after two years) but you probably need to configure your RDS instance to accept incoming requests from whatever IP address Heroku is running your instance on. Or (if this is just a hobby that you don't really care about) open all IP address. If the project is serious or has important data, don't do that.

You can change the IP restrictions by opening the rds instance in your aws console and looking at "security groups". You will probably see a rule for which IP addresses are allowed to access the instance -- that is what you should change.

Hope this works.

wbw20
  • 1