1

I have created my Amazon RDS in Oregon region. I have to configure this with my Heroku App. I am able to access RDS from my local machine. But this not happens with Heroku. I also don't have liberty to create Security Groups there. I am getting error as

ERROR 2003 (HY000): Can't connect to MySQL server on 'RDS hostname' (111)

something . I won't understand that because by my local machine it was resolving host but not from Heroku.

Kara
  • 6,115
  • 16
  • 50
  • 57
  • Are you using heroku web services that host by heroku? – mootmoot May 24 '16 at 10:02
  • no. I just hosted my app on heroku, and created database on RDS. so i want to link them –  May 24 '16 at 10:08
  • If so, you need to check whether Heroku allow apps to connect to external database, otherwise, you can only use Heroku hosted dbms. – mootmoot May 24 '16 at 11:17
  • yes, heroku allows to connect to external environment for database, that's why i was gone for RDS. only i had problem with the connectivity. –  May 24 '16 at 11:44
  • Only manage to find this. Quick glance show that you need SSL https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku To enable RDS SSL you need to do this http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html – mootmoot May 24 '16 at 11:53
  • ok thanks, i will check with this –  May 24 '16 at 12:44

1 Answers1

5

I Found solution myself, you just have to add inbound IP as 0.0.0.0/0 in security group for RDS to available it publicly.

  • 2
    How do you added the IP? Is this approach secure? Can you, please, provide more info and, if possible, reference some documentation? – Aerendir Aug 01 '17 at 16:41
  • More details from the Heroku documentation can be found [here](https://devcenter.heroku.com/articles/amazon-rds#authorizing-access-to-rds-instance). Specifically, the document states "You must grant Heroku dynos access to your RDS instance. The recommended way to do this is to configure the RDS instance to only accept SSL-encrypted connections from authorized users and configure the security group for your instance to permit ingress from all IPs, eg 0.0.0.0/0." – shawn Mar 01 '18 at 13:10
  • See this post for Best Practices on using RDS database with Heroku App https://vel-lesikov.medium.com/migrating-from-heroku-postgres-to-amazon-rds-2e738e7730e5 – VelLes Aug 25 '21 at 15:36