- Newest
- Most votes
- Most comments
Hello.
Are you trying to connect to RDS directly from your local PC with PGAdmin?
In this case, RDS does not have public access by default, so you need to enable public access and add a route to the Internet gateway in the subnet that RDS is using.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html#USER_VPC.Hiding
If you can use AWS ClientVPN, you can also connect using RDS's private IP.
https://aws.amazon.com/blogs/database/accessing-an-amazon-rds-instance-remotely-using-aws-client-vpn/
If you can use EC2 as a bastion instance, you can also use the port forwarding feature of Systems Manager Session Manager.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/
I was able to resolve the issue by adding a rule to the Elastic Beanstalk app's VPC security group to allow my mac's IP address. Steps:
- Navigate to VPC console
- select security groups
- select database security group added by Elastic Beanstalk
- Add inbound rule. For source, select a CIDR that includes your IP address (0.0.0.0/0 for all IPV4, e.g.)
To access an Elastic Beanstalk PostgreSQL database from outside AWS using pgAdmin or psql, you need to ensure proper configuration and permissions. Here are some steps to troubleshoot and resolve the connection timeout issue:
-
Check the security group: Ensure that the security group associated with your RDS instance allows inbound traffic on the PostgreSQL port (typically 5432) from your IP address or the appropriate range.
-
Verify endpoint and port: Confirm that you're using the correct endpoint and port for your RDS instance. You can find this information in the RDS console or the Elastic Beanstalk environment properties.
-
Check network configuration: If your RDS instance is in a VPC, make sure it's in a public subnet with an Internet Gateway, or set up a VPN or Direct Connect to access private resources.
-
Elastic Beanstalk environment properties: Verify that the environment properties for the database connection (RDS_HOSTNAME, RDS_PORT, RDS_USERNAME, RDS_PASSWORD, RDS_DB_NAME) are correctly set and accessible to your application.
-
Database user permissions: Ensure that the database user has the necessary permissions to connect from external sources.
-
Firewall settings: Check if there are any firewall rules on your local machine or network that might be blocking outbound connections to the database port.
To connect using pgAdmin:
- Open pgAdmin and add a new server.
- In the "General" tab, give your server a name.
- In the "Connection" tab:
- Host: Enter your RDS endpoint
- Port: Enter the assigned port (usually 5432)
- Username: Enter the master username
- Password: Enter the database password
If you've verified all these settings and still can't connect, you may need to review your Elastic Beanstalk and RDS configurations to ensure they're set up correctly for external access.
Sources
Using pgAdmin to connect to a RDS for PostgreSQL DB instance - Amazon Relational Database Service
Adding a database to your Elastic Beanstalk environment - AWS Elastic Beanstalk
Relevant content
asked 2 years ago
asked 3 years ago
asked 4 years ago

Thank you for your reply. I solved the issue. I needed to add a security group rule to allow my mac's IP address.