We run an elastic beanstalk application that comes with an application load balancer, let's call the environment core. On another EC2 runs our database.
I want to make the database accessible via instances in core only, how should I go about it?
VPC - too complicated, in my understanding both need to be in the same VPC and simply have the load balancer opened to the world. However, this comes with an overhead of setting up the VPC
Whitelist IPs on the database EC2 that correspond to the core EC2 instances. However, since this is a load balanced environment those IPs will change as number of instances scales up / down.
Whitelisting the LB security group in the EC2 database, but traffic still does not go through from EC2 EB to EC2 DB and I have no idea why. That would be my preferred way of doing it for now and I would really appreciate help here. Note: RDS Security group won't work if my understanding is correct since I'm using a custom DB on the EC2 - none of the AWS solutions. Here is the solution
If you use the public IP address, then AWS doesn't recognize the connection as originating from the EB security group and will deny the connection.