DBConnection Error in AWS deployment

I am try to deploy phoenix application to AWS using the guidelines as indicate on the docs.
When creating database using MIX_ENV=prod mix ecto.create . I ran into this problem
connection not available and request was dropped from queue after 10990ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by:

  1. Tracking down slow queries and making sure they are running fast enough
  2. Increasing the pool_size (albeit it increases resource consumption)
  3. Allowing requests to wait longer by increasing :queue_target and :queue_interval
    This is after try to increase pool_size to 15 and queue_target to 5000 as suggest by this solution.
    Making queries faster is not an option as this is still new app with nothing done.
    When I increase to queue_target to 10000 this the error, couldn’t be created: command timed out.
    Any help will be much appreciated

Hard to be sure from the error, but try checking to see if you can successfully connect to the database from the production machine using psql - AWS networking is easy to misconfigure but hard to detect misconfiguration.

@okothkongo to make sure I understand, this error is happening when you are trying to create the database with mix ecto.create ? I would make sure that the database user you are connecting with has the permissions to create databases. Generally, I would not use ecto to create a database in production. I would instead connect into AWS RDS manually and make a database, then make the user for your elixir application, and then grant that user permissions to do other changes to that database. Then you should be able to run migrations and stuff.

1 Like

Yeah I was running mix ecto.create at production, the RDS is way to go.My thinking was it could run purely on EC2 without involving RDS

1 Like