Hi, I have a web app deployed to flyio and Postgres DB publicly available on AWS RDS.
I’m getting this error:
2022-08-17T18:53:00Z [info]Datasource "db": PostgreSQL database "postgres", schema "public" at "database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com:5432"
2022-08-17T18:53:05Z [info]Error: P1001: Can't reach database server at `database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com`:`5432`
2022-08-17T18:53:05Z [info]Please make sure your database server is running at `database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com`:`5432`.
note to say that the connection string is valid and working from local machines.
$ s6-dnsip database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com
s6-dnsip: fatal: unable to resolve database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com: no such domain
Publicly accessible just means that the database has a public IP and it’s possible to access it from the public internet. You still have to allow access via security groups and network ACLs.
Networking stuff can be complex. I’d recommend running dig clara-database-fr-1.cxwsgpvudvax.eu-central-1.rds.amazonaws.com on both your local machine and on your fly VM to see if they are the same IP. Then I’d look at your security groups on that DB and also look at the VPC setup and make sure traffic is allowed to flow in and out for the IP ranges you’re working with.
You may also want to check that your database engine is configured to allow connections from fly as well. For instance, in mysql your connection is scoped to the user and host.
My RDS has a public access and I set up public IPV4 and IPV6 in my security group. But my application doesn’t reach out unless when I set “Anywhere IPV4” in my Security Group.
I want to accept connections only for my app fly.io public IP to port 5432 (i’m using postgres)