I have service in AWS ECS and service discovery maintains domain records like web.local
that points to tasks in that service.
I would like Network Load Balancer to point at domain web.local
instead of IP or Instance.
I know when I create service I specify Load Balancer and it magically setups everything for me. I can't find where web.local
is specified or service discovery.
I checked target group, etc.
To route domain traffic to an ELB load balancer, use Amazon Route 53 to create an alias record that points to your load balancer. An alias record is a Route 53 extension to DNS.
This DNS name includes the name of the AWS Region in which the load balancer is created. For example, if you create a load balancer named my-loadbalancer in the US West (Oregon) Region, your load balancer receives a DNS name such as my-loadbalancer-1234567890.us-west-2.elb.amazonaws.com .
There is an option to use service discovery, If you want to enable it you may do it while you are creating the ECS service.
The namespace name is the keyword after the dot(.), in our case it will be .local
.
There is also an option to add the Service discovery name*
this is the keyword before the dot(.).
Ref: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html
Update: You don't need it to point it to NLB if you are using service discovery option of ECS. There will be absolutely no role of the target group with it. ECS service will directly point a DNS name to your containers. If you want to use Load balancer bases service discovery then it's a different story altogether, Then you have to create a private hosted zone yourself and point it to your load balancer. But in the end, you can only choose one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With