0

I am trying to use virtual servers (instances) on Amazon EC2. I can assign (elastic) IP addresses to those instances and then assign my domain name to that IP.

However, I plan to use a load balancer. I know that due to some technical decisions, it is not possible to assign IPs to load balancers and I only get the url. The url is then translated to some IP address every time Amazon DNS servers receive a request (maybe based on region, etc.).

My problem is that I don't know how to use show my own domain name (e.g. "mydomain.com/items/abc.php" instead of load balancer url. When I use CNAME, the user is redirected to the load balancer's url ("load balancer url/items/abc.php") which is not what I want.

The solution that I have found is using Amazon Route 53 and set it as the DNS server of my domain. However, I prefer to keep my own DNS server. I am wondering if that's the only solution? And if that's the case, should I pay for Route 53 or it's free if I use EC2?

1

Route 53 is not required.

Setting a CNAME from www.example.com to load.balancer.url is the correct solution.

When I use CNAME, the user is redirected to the load balancer's url ("load balancer url/items/abc.php") which is not what I want.

If this is the result that you are getting, then you are not setting up the CNAME correctly. It sounds like you're doing some kind of redirection instead.

If the CNAME is setup correctly, then when you go to mydomain.com/items/abc.php, then you'll hit the load balancer, and the browser address bar will show mydomain.com/items/abc.php.

  • Yes, you were right. It is amazon's load balancer that is doing something. I tried with other websites/Amazon without load balancer and it worked. I wonder what's going on with Amazon load balancer. – Mehdi Jan 6 '17 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.