No access to AWS RDS from AWS ECS Docker Container
I have a spring boot app packaged in docker image(based on openjdk:8-jdk-alpine). As a datasource i want to use RDS. I configured postgresql RDS instance and i have access to it from my local box.
However when i deploy app to ECS i have the following issue: from EC2 instance i can access 5432 port:
nmap -Pn -p 5432 172.31.2.43 ... PORT STATE SERVICE 5432/tcp open postgresql
But from the docker container started on this instance i cannot access RDS:
PORT STATE SERVICE 5432/tcp closed postgresql
Both RDS and EC2 instance are within same VPC. Security group for RDS allow incoming connections from all ip addresses. I tried to start docker container with –net=host and it didn’t help. RDS endpoint seems to be not visible from container
Could anyone suggest what can be adjusted/changed?