#I'm struggling to connect my AWS ECS container to RDS Postgres due to SSL

1 messages · Page 1 of 1 (latest)

harsh briar
#

Hello, I'm trying to deploy my Medusa backend to AWS with Terraform and I have most of the infrastructure configured. I'm running on Fargate 1.4 and Postgres 17.2.

  • When I go run the npx medusa:migrate script during initialization I've been receiving the error no pg_hba.conf entry for host .
  • My RDS instance has force_ssl = true so when I added sslmode to my DATABASE_URL secret postgres://user:pass@host:port/medusa?sslmode=require the error changed to self-signed certificate in certificate chain.
  • I added my the cert file for my region to the docker image under /certs/region.pem and added it to the DATABASE_URL like so ?sslmode=require&sslrootcert=/certs/region.pem"
  • The connection cannot find the file, even though I confirmed the location of the file in the docker image.
  • I also tried a lot of the information on Medusa docs:
 projectConfig: {
    databaseDriverOptions: process.env.NODE_ENV !== "development" ?
      { connection: { ssl: { rejectUnauthorized: false } } } : {}
    // ...
  }

... 


Note: Make sure to add to the end of the database URL ?ssl_mode=disable as well when disabling rejectUnauthorized.

I tried this with both ?sslmode=disable and the suggested but this seems to suggest disabling SSL in production, neither worked either way.

The GitHub issues/discussions about this are totally silent for V2 config so I'm asking here. Has anyone managed to successfully set this system up that can offer guidance?

upbeat vault
#

@harsh briar Did you manage to fix this problem?

harsh briar
#

Hey I did. It took a lot of bumbling through, happy to give some assistance to avoid the same problems I did