0

I have setup an AWS Network Load Balancer no problem and I have a number of different services running on their assigned ports. This all works perfectly.

Then I was asked to host a number of different node apps on their own ports and are accessed via their own domains. After I realised I couldn't get this to work correctly on NLB I looked to Application Load Balancer and use Host-Based Routing rules.

  • app1.example.com
  • app2.example.com

What I did

I setup the application load balancer listener on https :443 and a Host-Based Routing rule that forwards app1.example.com traffic to a target group to watch 443 and send the traffic to the correct instance on port 3000. The security group is also setup to with port 3000 open.

So I thought.... all I had to do was add the load balancer IP to the subdomain A Records on the external domain registrar.... but I can't find the IP anywhere! I'm missing something fundamental here and AWS docs are killing me.

The above steps aren't too different from setting up a Network Load Balancer without the Host-Based Routing rules.

Could anyone point out where I can find the ALB IP or where am I'm going off track?

chris loughnane
  • 2,648
  • 4
  • 33
  • 54
  • 1
    AWS ELB/ALB IP addresses may change. Don't use it. This is wrong regardless: `add the load balancer IP to the subdomain A Records on the external domain registrar` add an A record ALIAS to your app domain pointing to the ELB's DNS name. – marekful Feb 11 '19 at 16:25
  • Thanks for commenting: I didn't think of that, I'm testing with a CNAME right now. – chris loughnane Feb 11 '19 at 16:36
  • `dig` reports the CNAME is active but I'm missing something in my target group.Or AWS is blocking my ALIAS. – chris loughnane Feb 11 '19 at 17:06

1 Answers1

1

The Ip might change so better use an other option such as CNAME or A-record + Alias (the latter might save you some money, if I remember correctly).

Aws ELB A record + Alias (Route 53 setup)

ohlr
  • 1,839
  • 1
  • 13
  • 29
  • I added a CNAME to the DNS of my Application Load Balancer and when I tried host app1.example.com on the subdomain I received not found (nxdomain). I understand the roaming IP so I'll avoid that. – chris loughnane Feb 11 '19 at 17:24
  • Have a look at the image I added - CNAME entries might take some time to propagate because of the DNS – ohlr Feb 11 '19 at 17:28
  • I'm using an external registrar not Route 53. Do you think this might be my blocker? – chris loughnane Feb 11 '19 at 17:43
  • As I said it takes time for DNS entries to propagate - maybe you just have to wait – ohlr Feb 11 '19 at 17:45
  • Nods. I'm running a few tests with a route 53 domain, changes there for internal AWS jobs are usually instant and I can see an IP coming back straight away. I'll post my findings here. – chris loughnane Feb 11 '19 at 18:01
  • 1
    Hi +ohlr, yes it does work and I intend to add a complete break down of what I did here so that other's can benefit from my work..... one task finished and another 10 appear :) – chris loughnane Feb 12 '19 at 14:50