Check your EC2 security groups for inbound rules that allow unrestricted access (i.e. 0.0.0.0/0 or ::/0) to TCP port 5432 and restrict access to only those IP addresses that require it in order to implement the principle of least privilege and reduce the possibility of a breach. TCP port 5432 is used by the PostgreSQL Database Server which is an object-relational database management system (RDBMS) server developed by PostgreSQL Global Development Group: https://goo.gl/PNbEY.
Allowing unrestricted PostgreSQL Database access can increase opportunities for malicious activity such as hacking, denial-of-service (DoS) attacks and loss of data.
To determine if your EC2 security groups allow unrestricted PostgreSQL Database access, perform the following:
To update your security groups inbound/ingress configuration in order to restrict PostgreSQL Database access to specific entities (IP addresses, IP ranges, etc), perform the following: