- Newest
- Most votes
- Most comments
To connect to your RDS instance in a private subnet while maintaining your App Runner setup, you need a secure approach that doesn't compromise your architecture.
Your current issue occurs because RDS instances in private subnets are intentionally isolated from direct internet access for security reasons. When you use an App Runner VPC connector, it's designed to allow your App Runner service to access resources in private subnets, but this doesn't automatically enable external access to those resources from your local network.
Here are some secure approaches to connect to your private RDS instance:
-
Create an EC2 instance in a public subnet of the same VPC, then use it as a bastion host to establish an SSH tunnel to your RDS instance. This allows you to connect securely without exposing your database directly to the internet.
-
Test connectivity using an EC2 instance within the same VPC as the RDS instance to verify your network configuration is correct.
-
Ensure your security groups are properly configured:
- The RDS security group should allow inbound traffic from your App Runner service's security group
- If using a bastion host, the RDS security group should also allow traffic from the bastion host's security group
- For your App Runner VPC connector:
- Verify you're using private subnets (not public subnets)
- Check that the security group ingress and egress rules are correctly configured
Moving all your subnets to the internet gateway route table isn't recommended as it defeats the security purpose of private subnets and could potentially expose your database to unwanted access.
The best practice is to maintain your private subnets for the database and use a secure method like a bastion host or AWS Systems Manager Session Manager to connect to your database for debugging purposes.
Sources
Community | Connect securely to an RDS instance
How to Successfully Connect AWS App Runner with a Privately Accessible RDS Instance? | AWS re:Post
Enabling VPC access for outgoing traffic - AWS App Runner
How to Successfully Connect AWS App Runner with a Privately Accessible RDS Instance? | AWS re:Post
When the service fails to connect to Amazon RDS or downstream service - AWS App Runner
In case it helps anyone then the solution was to create an ec2 instance in the VPC public subnet and then RDP into it and perform any db actions from there.
Relevant content
asked a year ago
