amazon web services - Trouble Connecting RDS in AWS with Replit - Stack Overflow

admin2025-05-02  2

I am running into an issue connect my AWS RDS to build my application. I have dont 15 different iterations with assistant but I am still getting the same error of failing to connect to the AWS database.

~/cosmos-backend$ python main.py
Testing database connection...
Host: cosmos-db.c4s4aoalsnz3.us-east-1.rds.amazonaws
Database: COSMOS-db
Port: 5432
Setting up SSH tunnel...
Tunnel config (excluding credentials): {'ssh_address_or_host': ('ssh.us.replit', 22), 'ssh_username': 'ScottSosso', 'remote_bind_address': ('cosmos-db.c4s4aoalsnz3.us-east-1.rds.amazonaws', 5432), 'local_bind_address': ('127.0.0.1', 6543), 'allow_agent': False}
Unexpected error: No password or public key available!
Failed to connect to database.
~/cosmos-backend$ 

I have the password setup in the secret key but it is still not connecting. Addtionally this is stemming from an issue where I had to create specific rules in AWS secruity groups

This error occurs in AWS when setting up the security group rule because you need to specify the CIDR notation correctly. When adding the Replit SSH server IPs, you need to append "/32" to indicate it's a single IP address in CIDR notation.

In AWS RDS security group, set up the inbound rules like this:

First rule:
Type: Custom TCP
Port Range: 5432
Source: Custom
CIDR: 35.165.38.90/32
Second rule:
Type: Custom TCP
Port Range: 5432
Source: Custom
CIDR: 34.122.157.26/32

Any insights ?

I outlined the items above on what I tried and my output

转载请注明原文地址:http://anycun.com/QandA/1746139275a92119.html