Problem connecting to postgres in RDS


#1

Hi, I’ve been previously using postgres as installed by docker. I’m now trying to move this to use a postgres database we’ve set up in RDS instead and can’t get the migration to work.

Running the following command sudo docker run -it --rm --network dev-hydra oryd/hydra:v0.11.6 migrate sql postgres://ousruser:[email protected]1.rds.amazonaws.com:5432 results in the following error message error=“Could not connect to SQL: pq: database “ouruser” does not exist”.

Issuing a similar command but removing the username:password nets me a different error ** error=“Could not connect to SQL: pq: Could not detect default username. Please provide one explicitly”**.

I can’t find any hints on any forums or searches and I’m still very new to Hydra. Is there any documentation on connecting to other databases? Everything I see uses docker to pull a postgres package to the same machine running Hydra. I’ll keep searching but feel stuck so I’d appreciate any help.


#2

Postgres states that the database does not exist. You must create it first. Database like in Collection of tables.


#3

I appreciate the reply, but I’m confused with the syntax of the command. The error seems to indicate the database is named ‘ouruser’. When communicating with the local sql database before, the syntax was postgres://admin:[email protected] If I want to communicate with a postgres database we have set up on RDS already, I can’t wrap my head around the exact syntax. The database has a name as well. I hate to ask what is likely a stupid question, but I couldn’t find it in my googling… what might a migrate command look like if it included username, password, databasename, and servername? Sorry for the confusion and thanks for any help you may have to offer.


#4

If you don’t define a database (the path of the URL postgres://u:[email protected]:1234/database_name) then postgres is defaulting to the user name for the db


#5

Ah, thank you!!! Just my lack of knowledge with postgres biting me. Your help is much appreciated, arekkas.


#6

No problem, you’re welcome!