0

i set up this environment on AWS:

VPC:

  • 1 Public subnet
    • Route table with Internet Gateway
  • 2 Private subnets
    • Route table with NAT

I created a subnetgroup with the private subnets and attached it to my RDS Postgres instance.

I Have a bunch of Lambdas in the same vpc (private subnets) that are connecting to the DB with no problem at all. I've added on the RDS Security Group the inbound rule to allow access from the Lambda Security Group and all is working fine.

I did the same thing for my EC2 in the same vpc (private subnet) where i'm hosting a Django Application. The EC2 and the RDS are in the same az Added the inbound rule on the RDS Security Group and added the RDS Full access (just for testing purposes) Policy to the EC2 IAM Role.

When i launch my application the build spec can download packages and resolve the host so i know my nat is working but when it does : python manage.py migrate (which connects to the RDS) it goes in timeout:

django.db.utils.OperationalError: connection to server at "db-postgres-dev-postgresinstance-xxxxxxxx.xxxxxxxx.eu-central-1.rds.amazonaws.com" (x.xx.xx.xxx), port 5432 failed: Connection timed out
    Is the server running on that host and accepting TCP/IP connections?

My NACLS are default so the problem won't be there.

How do i solve this?

2
  • You'll need to provide more information, precise information, to get help. You've misconfigured it in some way. Also, NAT in a private subnet is unusual, it usually goes in a public subnet to allow instances in a private subnet to access the internet.
    – Tim
    Commented Dec 14, 2023 at 19:00
  • Thanks @Tim, sorry i didn't explain clearly. The NAT is in a public subnet and a route table from a private subnet is pointing at it. I will provide more info on my configuration soon. Thanks for now!
    – ale_93_be
    Commented Dec 15, 2023 at 9:31

0

You must log in to answer this question.

Browse other questions tagged .