- Newest
- Most votes
- Most comments
Hello,
To resolve the issue of lost public access to your AWS RDS PostgreSQL instance, ensure the following:
Public Subnet Configuration: Ensure your RDS instance is only in public subnets. Having both private and public subnets can cause connectivity issues during failover.
Public Access Setting: Verify that the "Publicly accessible" setting is enabled for your RDS instance in the RDS console under "Connectivity & security".
Security Group Rules: Ensure the security group attached to your RDS instance allows inbound connections from your specific IP address on the necessary port (typically 5432 for PostgreSQL).
Internet Gateway: Confirm that your VPC has an attached Internet Gateway.
You can test connectivity using the Netcat command:
nc -zv your-rds-endpoint 5432
https://repost.aws/knowledge-center/rds-connectivity-instance-subnet-vpc
Certainly! Here’s a concise step-by-step approach to troubleshoot and restore public access to your AWS RDS PostgreSQL instance:
Steps to Restore Public Access to AWS RDS PostgreSQL Instance 1.** Verify Security Group Rules** Sign in to AWS Management Console > EC2 Dashboard. Navigate to Security Groups > Find the group attached to your RDS instance. Check Inbound Rules: Add or modify a rule for PostgreSQL (port 5432) to allow traffic from your IP (X.X.X.X/32) or 0.0.0.0/0 (for testing).
2.** Check Subnet and Route Table Settings** Navigate to VPC Dashboard > Check subnet associations and route tables. Ensure Public Subnet Configuration: If in a public subnet, confirm route to internet gateway (0.0.0.0/0).
3.** Verify RDS Instance Status and Logs** Navigate to RDS Dashboard > Verify instance status. Check Logs: Review RDS logs for any connectivity issues or errors.
4.** Test Connection** Connect to RDS Instance: Use PostgreSQL client (e.g., psql) to test connectivity with RDS endpoint and credentials.
5.** Verify DNS Resolution** Check DNS Resolution: Ensure RDS endpoint resolves correctly to its IP address.
6.** Check IAM Roles and Policies (if applicable)** Review IAM Roles: Ensure IAM roles and policies allow necessary access if using IAM authentication.
7.** Contact AWS Support (if needed)** If issues persist after these steps, consider contacting AWS Support for further assistance.
Summary By following these steps, you can troubleshoot and restore public access to your AWS RDS PostgreSQL instance effectively. Ensure security group settings, subnet configurations, and instance status align with your requirements for connectivity.
Hello.
My RDS instance is connected to both private and public subnets.
How about making the RDS subnets public subnets only?
If an RDS failover occurs and you start up from a public subnet to a private subnet, you may not be able to connect even if public access is enabled.
https://repost.aws/knowledge-center/rds-connectivity-instance-subnet-vpc
Note that RDS public access itself is not recommended for security reasons, so if possible, I recommend using the connection method as described in the following AWS blog.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/
@siunhan You wrote in your comment that having your RDS database in both private and public subnets shouldn't be an issue for public access. It is an issue, because the interfaces placed in private subnets haven't got (as they shouldn't) a direct route to the internet. All connections attempting to reach the interfaces in the private subnets will not receive a response for that reason, while connections to interfaces in public subnets will work.
Inside your VPC, all destinations are reachable by default. Your application workloads located in private subnets will be able to connect to your RDS database located in public subnets. You don't need to have the RDS database in private subnets to enable that.
Relevant content
asked 4 years ago
asked 2 years ago

Thanks for your comment. But my RDS instance also needs to connect to my private subnets and I think it shouldnt be issue for public connection if both public and private subnets are assigned. As mentioned above, I have internet gateway attached to my VPC and my security group attached to RDS instance allows all traffic to all ports from all IP address. I was able to access my postgres instance publicly before. I also read the blog user-port-fwd but I just want to understand why first.
Hi,
First of all, exposing the RDS database instance publicly is not recommended for security reasons. Instead, you should use port forwarding to connect to the DB instance. However, if you need to make your RDS instance publicly accessible, ensure it is deployed in a public subnet and that the "Publicly accessible" property is set to "Yes" under the "Connectivity & security" section in the RDS console. Additionally, make sure that the RDS subnet group contains only public subnets, not private subnets. This will ensure that the RDS instance is placed in a public subnet and Make sure that the inbound rules for the security group of your RDS instance allow connections from your source IP. Connectivity inside the VPC to private subnets is reachable by default, you just need to add a correct security group rules to allow the traffic to reach the RDS instance.
You can check the connectivity with Netcat command:
nc -zv DB-instance-endpoint port
Even if you are in a public subnet, you can communicate with resources in a private subnet if a route to the VPC CIDR is added to the subnet's route table. In other words, try configuring RDS to use only public subnets.