Using ALIAS for ELB if main website DNS manager is not Route 53

倖福魔咒の 提交于 2019-12-24 21:18:54

问题


I use Netlify to host my static site example.com. Since I don't want to append www, I have to use Netlify's DNS nameservers.

example.com uses API backend api.example.com, which is a CNAME record that resolves to an ELB address *.elb.amazonaws.com.

So 2 DNS lookup is required: first to example.com then to *.elb.amazonaws.com.

Alternative: Setup Route 53 with another custom domain example.org with an ALIAS record api.example.org that points to *.elb.amazonaws.com, and use api.example.org instead of api.example.com for example.com's API endpoints, then it'd have to look up example.com and api.example.org.

Is there any performance advantage advantage choosing the alternative? Would they be similar since the only difference is it has to lookup api.example.org instead of *.elb.amazonaws.com?


回答1:


Alias records are better than CNAME records, because they return an IP address directly upon resolution.

Example 1:

api.example.com as CNAME for *.elb.amazonaws.com

Your browser will resolve example.com first, download the HTML code, then upon execution of the page, it will need to resolve api.example.com. When it does this, it will:

  1. receive the CNAME result, then
  2. need to resolve *.elb.amazonaws.com

So in the above, there are a total of 3 resolutions required.

Example 2:

api.example.org as ALIAS for *.elb.amazonaws.com

Your browser will resolve example.com first, download the HTML code, then upon execution of the page, it will need to resolve api.example.org. When it does this, it will:

  1. receive the A result (IP address) directly

So in the above, there are a total of 2 resolutions required.



来源:https://stackoverflow.com/questions/47845088/using-alias-for-elb-if-main-website-dns-manager-is-not-route-53

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!