I'm running an AWS EC2 instance with a public IP address (e.g. 1.2.3.4
) and a service listening on 1.2.3.4:8080
. In front of this EC2 there is a Network Load Balancer with a target group pointing to the instance.
Now I want to enforce that all connections to port 8080 go through that load balancer.
For that I have added a security group to my EC2 that only allows incoming traffic to port 8080 from the load balancer's private IP address. But because the load balancer also uses the target's security groups for granting client access I need to add 0.0.0.0/0
to it as well because otherwise nobody can access the load balancer from the Internet. And with that the direct access to 1.2.3.4:8080
is possible for everyone.
Is there anything I can do about that?