Steve Robinson
Steve Robinson

Reputation: 3939

Elastic Beanstalk - RDS Postgres - Password auth failed

I have setup my Rails app on Elastic Beanstalk. But when I deploy it during asset:precompile when Rails is trying to access the database, it runs into this error from Postgres:

2014-09-21 21:28:35,302 [INFO] (7941 MainThread) [directoryHooksExecutor.py-29] [root directoryHooksExecutor info] Output from script: running 'bundle exec rake assets:precompile'...
/usr/local/share/gems1.9/gems/bundler-1.6.2/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /var/app/ondeck/vendor/bundle/ruby/1.9.1/bin in PATH, mode 040777
rake aborted!
PG::ConnectionBad: FATAL:  password authentication failed for user "ebroot"
FATAL:  password authentication failed for user "ebroot"
/var/app/ondeck/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `initialize'
/var/app/ondeck/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql_adapter.rb:831:in `new'

This is my database.yml:

production:
  adapter: postgresql
  encoding: unicode
  database: <%= ENV['RDS_DB_NAME'] %>
  username: <%= ENV['RDS_USERNAME'] %>
  password: <%= ENV['RDS_PASSWORD'] %>
  host: <%= ENV['RDS_HOSTNAME'] %>
  port: <%= ENV['RDS_PORT'] %>

And I have following config on my optionsettings file:

[aws:rds:dbinstance]
DBDeletionPolicy=Snapshot
DBEngine=postgres
DBInstanceClass=db.t1.micro
DBSnapshotIdentifier=
DBUser=ebroot

From the AWS Management Console for RDS I have checked that the user name is ebroot only. Yet its not connecting.

Thanks!


EDIT:

Okay I SSHed into the instance and tried to find out the value that was set for RDS_PASSWORD and to my surprise it was just the first four characters of the password!

Why could this have happened?

Upvotes: 3

Views: 2330

Answers (1)

jamesdelacruz
jamesdelacruz

Reputation: 217

You need to try if the connection is successful.

try this

1 login to your eb
eb ssh sampleapp-env

2 trigger connections

nc -vz your_eb.endpoint_url 5432

Upvotes: 1

Related Questions