Routing Multiple A Records To AWS LoadBalancer DNS

74 views Asked by At

AlB dns name : api.example.org (1) I will like to create 3 A records pointing to the ALB dns i.e api1.example.org, api2.example.org and api3.example.org

(2) in my service sitting behind the ALB, I will like to know which alias called my service. If api1.example.org caller my service I will like to have this information in my app service.

How do I go about achieving this?

Didn't really try much given I am not an expert with routing

2

There are 2 answers

0
AudioBubble On

If you want to route requests to targets behind an ALB based on you can use host based routing feature of the ALB.

The following 3 are requests to the same domain example.org

api1.example.org 
api2.example.org 
api3.example.org 

But different values will be present in the request HOST http header, this will let you route to your desired target groups, you can set this up in the ALB.

https://aws.amazon.com/blogs/aws/new-host-based-routing-support-for-aws-application-load-balancers/

Hope this helps

0
Mark B On

Just check the HOST HTTP request header in your service.