R shinyapp not connecting to AWS RDS through RMySQL

Hello,

I am having trouble connecting to my AWS RDS database from within my R shiny app on a different AWS EC2 instance.

I can connect no problems from Rstudio on my computer, however when I use the same code on the EC2 instance, it does not connect, receiving this error:

Error in .local(drv, ...) :
  Failed to connect to database: Error: Can't connect to MySQL server on '***rds.amazonaws.com' (110 "Connection timed out")

My code is:

  db = dbConnect(MySQL(),
                   user='***',
                   password='***',
                   dbname = '***',
                   host='***',
                   port = 3306)

I have tried these solutions with no success:


There was another similar solution to above using a different package (dbplyr?) which also didn't work and can't refind the link.

Could not figure out how to implement this solution, the problem seems very similar:

It seems other people have experienced this issue, but I can't seem to find a solution online.

I still haven't found a solution for this yet and it's driving me crazy, is there anything extra I can provide that could help solve this problem? I followed this tutorial for creating an AWS RDS:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateDBInstance.html
However the first RDS I created I didn't follow those instructions properly (but I can connect to it in Rstudio on my home computer), when following those instructions properly (or so I think I have), I can't connect to the RDS from anywhere...

I found the solution here:
https://forums.aws.amazon.com/thread.jspa?threadID=102827

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.