AWS EC2 security groups not working as expected
Solution 1:
If you want to refer the worker_security_group
from server_security_group
you must make sure that the workers use Private IP addresses of the servers when they talk to them.
Public and Elastic IPs (e.g. 52.x.x.x or 13.x.x.x or 3.x.x.x or similar) do not carry the Security Group info with them, only the Private IPs ones do.
For example:
- Server has Private IP 172.16.1.2 and Public IP 52.12.34.56
- Worker has Private IP 172.16.2.3 and Public IP 13.14.15.16
With your Security Group setup where you reference the Worker SG from Server SG the Worker can connect to Server's 172.16.1.2 but not to 52.12.34.56.
Hope that makes sense :)