Search code examples
amazon-web-servicesamazon-rdsaws-security-group

Connect Lots of servers from multiple cloud providers to AWS RDS


We have a centralized postgresql database hosted on AWS RDS, and also many applications deployed to both AWS and Azure that needs to connect to this database.

For security reasons, our database is firewalled, and we use a security group with an inbound entry for each of our applications IP address, to let it access the database.

We deploy and stop multiple applications each day, so the IP addresses of the applications that needs to connect is dynamic.

There's one problem - there is a limit on the number of entries in a security group.

How can we connect a large number of applications from multiple cloud providers to our database ?

edit: Initially I incorrectly stated that our applications are only deployed on AWS EC2, but the whole point is that our applications are hosted both on AWS and on Azure.


Solution

  • Instead of specifying IP addresses in the security group rules, specify security group IDs. This will allow any server that belongs to a specific security group to access your RDS server.