AWS ECS – how to route traffic based on client header to different service instances

We moved our services to AWS ECS. We want to create different instances of those services which can differ in the:

  • underlying EC2 instance size – e.g. higher CPU and RAM for bigger customers, smaller shared instances e.g. Demo clients
  • a different version of the service

Ideally, we would like to use custom headers (e.g. client-id) to decide on the routing. Is this approach correct? How to achieve that? Can you share any best practices in this space? Could this be achieved using only Application Load Balancer without API Gateways? Can we have a single cluster with different EC2 instances manually attached or better to create multiple clusters e.g. demo, standard and premium?

Leave a Comment