Context #
So a while back I wanted to know how Network Load Balancer (NLB) stickiness worked. I could not find this information online anywhere. After speaking to AWS support and doing some testing myself I have come to the following conclusion.
The NLB will reset sticky sessions if the health of any targets change. Or more importantly if you register / deregister targets.
However, if the above events do not happen stickiness seems to be permanent.
“the stickiness is permanent. As long as the same client/source IP keeps going to the same NLB node the NLB will keep forwarding the TCP connections to the same target for as long as the target is healthy. If the target goes unhealthy, the stickiness then breaks.” - AWS Support
This was important for me to determine because I had a legacy application using NLB’s where we did rolling releases that were not backwards compatible meaning new versions talking to old versions would be problematic. Normally sticky sessions would fix this, however since they reset on target deregistration it was back to the drawing board.