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
5432/tcp open  postgresql

But from the docker container started on this instance i cannot access RDS:

  • Docker push to AWS ECR fails on Windows: no basic auth credentials
  • Port forwarding in when running a Tomcat Docker in an AWS Elastic Beanstalk application
  • Issues with AWS Route53 setup for Multi Docker Container
  • AWS ECS container with tomcat + jdk
  • What is the minimum healthy percent and maximum percent in Amazon ECS
  • Supervisord in Docker + AWS Elastic Beanstalk can't accept non-alphanumeric environment variables
    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?

  • How to provide certificates to mongod containers on different nodes in swarm cluster for internal authentication?
  • Configuring MongoDB replica set from docker-compose
  • Where is the time spent starting a docker image?
  • TravisCI/Docker support: iptables: No chain/target/match by that name
  • Docker-Distribution: cannot pull from different machine (FATA[0000] Error: image sample-web-app:latest not found)
  • Docker container not responding
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.