0

For my case, I have a Route 53 public DNS record, let say abc.com. This abc.com has a A record pointing to an ALB which routed to an EC2 (let's name it as EC2 A).

Normally, there are requests from internet calling this abc.com which will then routed to EC2 A. But for some case, EC2 in the same VPC of EC2 A will call abc.com as well. For this case, it will still go through the external path to reach EC2 A. But as both EC2 is in the same VPC, is there any way calling abc.com can be routed internally instead of going through the external path?

Steve
  • 175
  • 1
  • 3
  • 14

1 Answers1

0

Consider creating private hosted zone as well for your domain in AWS route 53.

The domain abc.com uses a public hosted zone so it will always be routed through the internet.

Sam
  • 4,046
  • 8
  • 31
  • 47
  • Thanks Sam. I don't want to change the name for this case, i.e. stick to use abc.com. Is there anything can be done in the DNS in EC2 so that routing abc.com internally can be achieved? – Steve Jul 28 '21 at 15:45
  • @Steve yes you can achieve this by doing one thing in EC2, In your ec2 machine edit your host file which is located at /etc/ and add your DNS with the private IP of your other EC2 machine . – Sam Jul 28 '21 at 15:52
  • 1
    You can setup the same domain as a private hosted zone, which will then allow you to override how specific addresses are resolved internally in your VPC. As mentioned above, you'll have to point it directly to the EC2 instance's private IP instead of the load balancer. – Mark B Jul 28 '21 at 15:55
  • @MarkB Thanks for that but he can try using an internal loadbalancer instead of directly accessing the EC2 instance's private IP, what do you think? – Sam Jul 28 '21 at 16:02
  • Thanks. So it sounds like I need to do 2 things. One is to create a private hosted zone which is the same as name abc.com. Second it's to create an internal LB which used to point to the EC2 and the private zone DNS record points to the internal LB. Is that correct? – Steve Jul 29 '21 at 15:05