Search code examples
amazon-web-servicesamazon-route53

AWS Route 53 - How to route traffic to Load balancer including context path?


I have a domain company.com, in route 53 I successfully created sub-domain sales.company.com. I have a load balancer running a service with a context root path(e.g. rootpath). I can access the app using loadbalancerdns/rootpath. I tried to create an A record in route 53 to point sales.company.com traffic to loadbalancerdns/rootpath but it does not allow it but if I point to loadbalancerdns then it works and I can access the service using sales.company.com/rootpath.

My question is it possible to route sales.company.com to loadbalancerdns/rootpath ? If not how can this be achieved?


Solution

  • You can't do this. Route53 is DNS provider and it does not have a concept of an url path. You can only create records to full odmains sales.company.com (not sales.company.com/url-path or IP addresses.

    You can create path based routing in your application load balancer using listener rules, or front your load balancer with CloudFront. The CloudFront allows you to respond differently to different paths in your url.