aws-solutions-library-samples / guidance-for-natural-language-queries-of-relational-databases-on-aws

Demonstration of Natural Language Query (NLQ) of an Amazon RDS for PostgreSQL database, using SageMaker JumpStart, Amazon Bedrock, LangChain, Streamlit, and Chroma.
https://aws.amazon.com/solutions/guidance/natural-language-queries-of-relational-databases-on-aws/
MIT No Attribution
58 stars 10 forks source link

Error connecting to database, SSL required #48

Open brnkrygs opened 1 year ago

brnkrygs commented 1 year ago

Hello,

I've run into an error starting up the ECS Task where the Task is unable to connect to the PostgreSQL database.

After investigation, I've found that it looks to be erroring out because PostgreSQL15 defaults to forcing SSL connections for all clients (this is a new behavior for PostgreSQL15 in RDS). The code looks to be using a non-SSL connection.

I was able to fix this by creating a new parameter group that disables the requirement.

Looks like this might also be fixable by forcing SSL in the posgresql connection string (which is probably a better approach from a security perspective - still testing this).

Relevant reference from RDS documentation

The default rds.force_ssl parameter is set to 1 (on) for RDS for PostgreSQL version 15. All other RDS for PostgreSQL major version 14 and older have the default value for rds.force_ssl parameter set to 0 (off).

Thanks for creating this project, its been very useful!