How to handle network load balancer health checks when using dynamic ports with UDP traffic?

0

My setup: 1 NLB (UDP traffic) using dynamic port mapping to ECS tasks.

Question: The NLB only sends health checks on the mapped port and only as TCP, HTTP, HTTPS. My ECS task definition maps my container's port to the host port using UPD. This works fine, however, I'm unable to add an additional mapping, on the same port, for TCP. I'm also unable to use a custom health check port because dynamic port mapping is enable.

That said, how should NLB health checks be handled when using dynamic port mapping and UDP traffic?

asked 2 years ago858 views
1 Answer
0

There are a couple ways to handle Network Load Balancer (NLB) health checks when using dynamic ports for UDP traffic:

  1. Use TCP health checks on the NLB and have the application respond to TCP probes on the same port as the UDP traffic.

The NLB will send TCP health checks to the mapped dynamic port. As long as your application handles and responds to those TCP probes, the NLB will consider the target healthy. The downside is your app needs to support TCP in addition to UDP on that port.

  1. Use a secondary "health check" port mapped to the container.

For example, map UDP traffic on dynamic port 0. Have a second static mapping from the host (port 1024) to the container (port 80). Configure the NLB health check to use HTTP/TCP on host port 1024. Your application would need to handle HTTP GET requests on port 80.

  1. Disable NLB health checks and implement health checks in the application

Since NLB health checks are limited for UDP, you can disable them on the load balancer. Implement health checking logic in the application itself, and have the ECS service scheduler replace any unhealthy tasks.

Overall, options #1 or #2 are best to leverage the NLB health checks. But #3 is a viable alternative if needing only UDP. The important thing is ensuring the NLB has a way to assess the health of the targets to route traffic appropriately

AWS
Saad
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions