Security Group ID’s
Now that the SQL Security Groups are created, we can copy their ID’s and link them together so only they can communicate.
Copy each of your newly created group ID’s to a notepad or text editor of your choice:
Once you have both the SQL-IN and SQL-OUT Group ID, we need to edit each of groups and include the other’s ID.
Here is where this gets interesting, we include SQL-OUT’s ID for SQL-IN and the SQL-IN ID for SQL-OUT.
Then we just enable both of these security groups in our EC2 and RDS Instance and they are able to exclusively communicate.