Search code examples
amazon-web-servicesaws-security-groupamazon-elb

AWS loadbalancer Egress rule confusion


I have 4 servers and a loadbalancer (Type: AWS::ElasticLoadBalancingV2::LoadBalancer) over them. I have port 80 in ingress and 0-65535 in egress rule in security group for servers. In the security group of LoadBalancer for ingress rule any port works but if I change port of egress rule port from 80 to any other, my loadbalancer doesnt work. For 80 port in egress rule it works perfectly.

Is it suppose to be 80 always? Or is there something with my settings? I am quite new to AWS and would appreciate any help. Thanks in advance.


Solution

  • Normally Loadbalancer exposes port 80 and 443 for the public, but you can expose the other ports but for web-app good to use these two only.

    but if I change port of egress rule port from 80 to any other, my loadbalancer doesnt work. For 80 port in egress rule it works perfectly.

    They are two reasons that it stopped working

    • The application is listening on port 80
    • The load balancer listener port bind with 80

    In normal cases like Loadbalancer, you should not change egress or the outbound rule.

    Recommended Rules for Load Balancer Security Groups

    The security groups for your load balancers must allow them to communicate with your instances. The recommended rules depend on the type of load balancer (Internet-facing or internal). enter image description here

    elb-security-groups