Reputation: 33
Not able to connect to RDS PostgreSQL 9.3 database from EC2 (elastic-beanstalk). Environment was created using the Elastic Beanstalk v3 CLI with PostgreSQL 9.3.5, Puma (Ruby 2.1), Rails 4.1.6. postgresql93-devel was successfully installed by yum through .ebextensions/postgres.config:
packages:
yum:
postgresql93-devel: []
SECRET_KEY_BASE has been added to Environment table through console.
Getting the following error on rake db:migrate during eb deploy:
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
RDS_HOSTNAME, RDS_DATABSE, RDS_USER_NAME, RDS_PASSWORD: all verified in rails console by ssh'ing to ec2 box.
config/database.yml:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
production:
<<: *default
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
hostname: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>
Any thoughts?
Upvotes: 3
Views: 2492
Reputation: 7997
It seems you have mistakenly written hostname instead of host in database.yml
Upvotes: 1