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.
I get a dns lookup error:
$ 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
Have you ensured your security group settings allow IP4 access from ... or your FlyIO public IP address?
No. Should I? The rds set to Publix access
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.
not sure i understand why… if i can connect from my local machine, why can’t I connect from within fly?
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.
I’m facing same issue!
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)
Does anyone have a tip for me?
outbound IP addresses from your fly.io app are not static. You won’t be able to specify a “whitelist” for your IP address on an external service like AWS. You will have to allow accept any IP address range for now. See here Set/get outgoing IP address for whitelisting on external APIs/Hosts