How do you route a root domain to an application balancer via a static IP address?

0

I am using Elastic Beanstalk to deploy my docker container app, I want to route my custom domain to the web server but this domain is a root domain, so I cannot use CNAME, instead I have to use the IP addresses of the application load balancer. But the ALB IP addresses change over time, so I need a static IP address for routing. Currently I managed to do this by hosting a static IP address that redirects mydomain.com to www.mydomain.com and routing www.mydomain.com to the server via CNAME since it's not a root domain. This process is kinda complex.

I wonder if there is any simpler method to realize this? Thanks.

2개 답변
1

Have you tried using an Alias record? Inside of Route53 when you are creating a record, there is a toggle switch for "Alias". Enable this, and then you can point the root domain directly to the Elastic Beanstalk instance, or the Application Load Balancer.

Some documentation that will help:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-elb-load-balancer.html

profile pictureAWS
전문가
Chris_G
답변함 2년 전
  • This domain is not hosted by Route 53 and I wouldn't let Route 53 host this domain because there are many other DNS hosts under this domain.

  • Apologies, I saw that you tagged Route 53 to this question so I assumed you were using the service. Unfortunately if the zone is not hosted within AWS, it's very hard to map it without using a CNAME and following the same procedure you're doing now.

1

If you don't require all the features of an ALB you can use an NLB with an elastic IP and point the domain to this.

Otherwise you can put the NLB in front of the ALB. NLBs now accept ALBs as a target group so this will handle the changing ALB address with no need for funky extra coding.

https://aws.amazon.com/blogs/networking-and-content-delivery/application-load-balancer-type-target-group-for-network-load-balancer/

Hope this helps

답변함 2년 전
  • Can i automated above process using Lambda or cft

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠