I'm starting with AWS and trying to access a running instance from another running instance by using the ELB. I can access the load balancer if I open the port and add to the source column 0.0.0.0/0. However, this opens a security thread. Is it possible to access from the instance only that open port without using the 0.0.0.0/0. I've tried by adding the security group of that instance to the Inbound roules of the ELB without success.
PD: I cannot put the instance public IP address to the source column of the ELB to allow traffic from that IP because the IP can change as it belongs to an autoscaling group which will launch new instances if one fails.
The reason for the issue is pretty much this: https://stackoverflow.com/a/42584737/9835872
Your only solution is to associate elastic IP addresses with the instances, and then whitelist those elastic IPs in your security group. Unfortunately if your autoscaling group is creating more than once instance, you have to add a separate elastic IP for each of them more or less manually: https://stackoverflow.com/a/46400392/9835872