In order to reduce latency and resource cost, website maintainers usually deploy their web service on servers located in separate geographic areas. However, since it’s a relatively inconvenient task for users to manually decide which server they should connect to, developers might desire a solution which could automatically allocate users according to their location.
Recently, as the developer of Encrypted-DNS project, I’m using Azure Traffic Manager to address the concern I mentioned above because the latency of DNS queries plays an essential role in users’ experiences. For instance, my DNS service is currently running on two separate computing engines provided by Google Cloud Platform, which locate in both the United States and Taiwan. Therefore, for users located in Asia, all of their DNS queries will be directed to the server in Taiwan; for users in other areas, their queries will be sent to the server in the United States.
Create a Traffic Manager profile
Go to Azure Portal, navigate to Traffic Manager profiles, and then click on ‘Add new’ button to create a routing profile. Provide a name for the profile, which will be added to the CNAME record of your domain, set ‘Routing method’ to ‘Geographic’, and set resource group and subscription.
After successfully creating the routing profile, navigate to Traffic Manager profile page and you will see the details. To add your server, select the profile you have added and click on ‘Add endpoint’. If your server is provided by Azure, you should set the type of the endpoint to ‘Azure endpoint’ and then select your service. By contrast, you may select ‘External endpoint’ and specify the domain name or IP address of your server.
Subsequently, you have to set the regional grouping of the server you selected above:
- World – any region
- Regional Grouping – Africa, Middle East, Australia/Pacific, etc.
- Country/Region – Ireland, Peru, Hong Kong SAR, etc.
- State / Province – USA–California, Australia–Queensland, Canada-British Columbia, etc. (Note: This granularity level is supported only for states / provinces in Australia, Canada, UK, and USA)
Add DNS record
After creating all the endpoint, add a CNAME record of the name of your Traffic Manager profile such as ‘encrypted-dns.trafficmanager.net’ to your domain. To cost price, you should view the Traffic Manager Pricing page.