我有一个RDS实例,我可以通过命令提示符连接如下:
mysql --host=rds-instance-name.ciplxctxy9hy.us-west-1.rds.amazonaws.com --user=username --password=password database
这很有效。当我尝试eb deploy
到Amazon Web Services弹性beanstalk实例时,我收到此错误:
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-08388abd] Command failed on instance. Return code: 1 Output:
(TRUNCATED)...ash -c 'leader_only bundle exec rake db:migrate' webapp
rake aborted!
Mysql2::Error: Can't connect to MySQL server on 'rds-instance-name.ciplxctxy9hy
.us-west-1.rds.amazonaws.com' (4)
我的ruby实例中的database.yml
文件包含以下内容:
production:
adapter: mysql2
encoding: utf8
database: database
username: username
password: password
host: rds-instance-name.ciplxctxy9hy.us-west-1.rds.amazonaws.com
当我在本地启动ruby服务器时,我没有错误:
C:/Development/Ruby/environment-name/bin/rails server -b 0.0.0.0 -p 3000 -e production
我需要更改为rds实例或database.yml
以允许我部署?
答案 0 :(得分:1)
我会查看RDS实例上的安全组,并确保它允许来自EC2实例的传入连接。