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:

  • Multilayer Docker Deployment on AWS
  • Docker containers seem to 'inherit' the instance profile of the host ec2. How?
  • Recommendation: Deploy Docker application to AWS
  • Docker container out of sync with host
  • Docker on AWS. ECS or Docker Datacenter
  • Is 2 the minimum number of instances to properly deploy a container on AWS?
    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?

  • implementing reverse proxy with nginx and docker containers with different ports
  • Persistent mysql data from docker container
  • docker-compose rails with mysql
  • How to add PostgreSQL datasource to WildFly Full 9.0.1.Final?
  • Enable Docker remote API in Mac (Using Docker Quickstart Terminal)
  • Create a docker container with no DNS nameservers in /etc/resolv.conf
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.