loading...
Cover image for AWS ALB routing based on HTTP method

AWS ALB routing based on HTTP method

k4ml profile image Kamal Mustafa ・1 min read

tldr;- It's not possible at this moment.

The new AWS ALB has more flexible way to route incoming requests compared to ELB classic but still fell short. It only support path or host based routing. So you can route requests to /customers/logs/ and /customers/orders/ to different target group, like different cluster of ec2 instances.

But it's not possible to route based on http method, like POST /customers/orders/ and GET /customers/orders/ to different target. One practical use case is when GET /customers/orders/ will be resources intensive and you want to segregate the requests to avoid impact on other parts of your services.

Today, a friend also shared about load balancer from the guy at Gojek (ride hailing services in Indonesia) called Weaver. It seem to support method based routing:-

{
  "id": "gojek_hello",
  "criterion" : "Method(`POST`) && Path(`/gojek/hello-service`)",
  "endpoint" : {
    "shard_expr": ".serviceType",
    "matcher": "body",
    "shard_func": "lookup",
    "shard_config": {
      "999": {
        "backend_name": "hello_backend",
        "backend":"http://hello.golabs.io"
      }
    }
  }
}

The criterion expressed based on Vulcand Routing, which is another load balancer from MailGun. The vulcand documentation say:-

package route provides http package-compatible routing library. It can route http requests by hostname, method, path and headers.

And that's all for my own notes.

Image credit to https://www.flickr.com/photos/small_realm/14699606019.

Posted on by:

k4ml profile

Kamal Mustafa

@k4ml

Python/Django Developer at xoxzo.com.

Discussion

pic
Editor guide
 

Advance requests routing finally come in ALB - aws.amazon.com/blogs/aws/new-advan....