1

We were using Application Load balancers earlier and session stickiness worked like a charm. Recently, we switched to the network load balancing and it's not working consistently, to make it worse we don't find any mention of session stickiness around network load balancers. We have the target groups as the backend application servers. Is network load balancer even an option for our use case?

Mahesh H Viraktamath
  • 818
  • 3
  • 14
  • 34

2 Answers2

12

Sticky sessions are available for AWS Network Load Balancers. You simply set the switch on the target group properties. NLBs use IP addresses to control the stickiness. This means that if you have a lot of users with the same IP (behind a NAT for example) then they will all hit the same server. Note that stickiness is not available if you are using TLS termination on your NLB.

https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#sticky-sessions

Lee Jensen
  • 2,151
  • 2
  • 21
  • 23
  • 1
    Isnt that the other way? i.e session stickiness is not available if TLS does not terminate at NLB but available if it terminates at NLB? or this is not available in both the cases? – Manikandan Kannan Sep 16 '20 at 10:13
  • 2
    No, you cannot enable stickiness if your target group protocol is TLS. You will get an error when you try and save the configuration. See the docs mentioned above: "Sticky sessions are not supported with TLS listeners and TLS target groups." If you set the group protocol to TCP then sticky sessions work fine with NLB. – Lee Jensen Sep 17 '20 at 14:52
-4

I think, session stickiness won't be possible on a TCP level load balancer. The ELB use cookies to implement session stickiness, so it won't be possible on a TCP connection.

  • 2
    it would have been nice if the had something like "IP stickiness" though – Nikolay Dimitrov Nov 23 '18 at 02:05
  • 2
    This is incorrect. The question is about Network Load Balancers (NLB). AWS supports IP stickiness for NLB. https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#sticky-sessions – Lee Jensen Sep 17 '20 at 15:05