'Intra-RDS Database communications setup on common VPC and security groups

I have a production database plus a new database that I stood up on AWS. Both are Postgres. I wanted to use replication to copy a table from production into the new database. I did an nslookup to get the public IP of the new database and added it into the incoming rules for the security groups. After getting all the postgres commands in, I can replicate just fine.

I understand that the RDS IP addresses are not static. The incoming rule takes an IP address as an input so it is conceivable that the rule breaks if the IP address changes. What is the correct method for adding a database to the security group so that the rule can withstand an IP address change?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source