1

I have one running application load balancer which redirect traffic to my two instances. Let assume xyz.com redirect traffic to my instances 1 and 2. My A record xyz.com---alburl working file. Now I have two more instance 3 and 4 and one more target group tg2 for same. I have added host path /custom rule in load balancer and forward to tg2 and able to access service of instance 3 and 4 using "xyz.com/custom". Can I add one more A record which point "custom.xyz.com" which redirect alburl/custom?

k''
  • 702
  • 1
  • 8
  • 19
  • 1
    Please don't use other people's domain names as examples. The domains http://example.com and http://example.org are specifically reserved for exactly that purpose. – Michael - sqlbot Mar 04 '19 at 05:42

1 Answers1

2

There is no limit to the number of A record aliases you can point to one ALB, so, yes, you can.

To do what you are asking, after setting up the new DNS entry, create a rule on the balancer matching the new hostname and redirecting to the desired URL.

With redirect actions, the load balancer can redirect incoming requests from one URL to another URL.

https://aws.amazon.com/about-aws/whats-new/2018/07/elastic-load-balancing-announces-support-for-redirects-and-fixed-responses-for-application-load-balancer/

But there's really no need to do it with a redirect, unless that is really what you want. You can also just create a rule to match requests for the new hostname (and, optionally, the path) and send those requests directly to the new target group.

You will probably also want to add a new SSL certificate for the new hostname. ALB allows you to add up to 25 additional certificates. It automatically selects the correct certificate for each new connection using SNI.

Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427
  • Hi michael, can you check my long comment https://drive.google.com/open?id=1JKOwfLW3MmYoKPpNBEYIODWw1TGu98sYN6odw4KCAPM – k'' Mar 04 '19 at 12:23
  • If you would like to engage my professional services for a fee, I would be quite happy to do that. Otherwise, we need to keep the dialog public for the benefit of future visitors. Your comment indicates that you were trying to use custom.example.com as an alias to alb-hostname/custom, which is invalid because DNS does not concern itself with paths. Point the new hostname to the normal ALB name, then **create an ALB rule to match the hostname** custom.example.com and set the destination as the new target group, and it will work. No need for the path "/custom" unless you really want that. – Michael - sqlbot Mar 04 '19 at 13:39
  • thanks, i did it by entering hostname "custom.example.com" instead of path when enter new rule . – k'' Mar 04 '19 at 15:41