开发者

Trouble connecting Heroku App with Amazon RDS Instance

开发者 https://www.devze.com 2023-01-20 15:49 出处:网络
I\'m using Amazon RDS for the first time ever and I\'ve been following the heroku docs to get my app using the RDS instance. So far I\'ve created an instance and I have setup the addon using the forma

I'm using Amazon RDS for the first time ever and I've been following the heroku docs to get my app using the RDS instance. So far I've created an instance and I have setup the addon using the format:

$ heroku addons:add amazon_rds url=mysql://user:pass@rdshostname.amazonaws.com/databasename

After running heroku rake db:migrate I got

!!! The bundled mysql.rb driver rake aborted! no such file to load -- mysql

So I installed the MySQL gem. Doing the same thing again I got the error:

Can't connect to MySQL server on 'myapp.cqslpaxxqrok.eu-west-1.rds.amazonaws.com' (110)

I see there's a note about the instance being in the US-east region for Hero开发者_C百科ku's security group to control access or something. Can I not use a European instance?


No, you cannot use a European instance. Heroku is only available on the US East zone right now, and you need to be able to add Heroku to your security zone for the RDS instance to work, which I suppose require you to be in the same zone. More imporantly, you want to be in the same zone as Heroku for latency and security reasons (otherwise your database traffic will be travelling over the Internet).


Heroku changed its procedure to allow Heroku servers to connect to RDS instances. The accepted answer to this question is not true anymore.

You have to 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 and configure the security group for your instance to permit ingress from all IPs.

Previously, Heroku published its AWS account ID and security group name as a way to grant access to an AWS RDS instance. This is no longer recommended.

Ref: https://devcenter.heroku.com/articles/amazon_rds

0

精彩评论

暂无评论...
验证码 换一张
取 消