Database "kong" does not exist


#1

Setting up kong in amazon linux with an RDS postgres database. Created database named “kong” which is up and running. Here are the relevant conf file entries:

database = postgres
pg_host = kong-db.cjtzpy1hzftb.us-east-2.rds.amazonaws.com
pg_port = 5432
pg_timeout = 5000
pg_user = kong
pg_password = ********
pg_database = kong

When I run kong migrations up, I get the following:

2019/02/11 17:49:09 [verbose] prefix in use: /usr/local/kong
Error:
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:91: [PostgreSQL error] failed to retrieve server_version_num: FATAL: database “kong” does not exist
stack traceback:
[C]: in function ‘assert’
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:91: in function ‘cmd_exec’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:87>
[C]: in function ‘xpcall’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:44>
/usr/local/bin/kong:7: in function ‘file_gen’
init_worker_by_lua:48: in function <init_worker_by_lua:46>
[C]: in function ‘xpcall’
init_worker_by_lua:55: in function <init_worker_by_lua:53>

I think security groups are all fine. Any thoughts?


#2

Are you able to see how long the kong start to the failure is taking? I ask as if the connection appears to be timing out, you might have a security group issue.

Otherwise, I recommend double checking the values, including using psql from the EC2 instance.


#3

Thanks for the recommendation of using psql from the EC2 instance. I had the database name and the instance the same. When I changed pg_database to be ‘postgres’ instead of ‘kong’ in the config file, all worked. Appreciate the assist.