Cameron Aziz
Cameron Aziz

Reputation: 487

Elastic Beanstalk can not connect to RDS

I have an RDS instance that I can connect through command prompt as follows:

mysql --host=rds-instance-name.ciplxctxy9hy.us-west-1.rds.amazonaws.com --user=username --password=password database

This works well. When I attempt to eb deploy to the Amazon Web Services elastic beanstalk instance, I get this error:

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)

My database.yml file in my ruby instance has the following:

production:
  adapter: mysql2
  encoding: utf8
  database: database
  username: username
  password: password
  host: rds-instance-name.ciplxctxy9hy.us-west-1.rds.amazonaws.com

When I locally start the ruby server, I get no errors:

C:/Development/Ruby/environment-name/bin/rails server -b 0.0.0.0 -p 3000 -e production

What do I need to change to the rds instance or to the database.yml to allow me to deploy?

Upvotes: 0

Views: 681

Answers (1)

Brian
Brian

Reputation: 5491

I would look at the security group on the RDS instance and make sure it's allowing incoming connections from your EC2 instance.

Upvotes: 1

Related Questions