Aurora DNS forms a powerful combination with our Aurora Compute services. In this tutorial we explain how to configure Aurora DNS to be combined with multiple Aurora Compute instances. We also added a functional demo to fully experience the end result.
Before starting this tutorial you are required to have a few things in place:
- Two virtual machines with a running web server.
- A domain name, preferably one registered through PCextreme.
In this example we have created two Aurora Compute Agile instances, geographically spread over multiple zones. These are web01-demo.auroradns.eu and web02-demo.auroradns.eu, which are reachable through the following IPv4 and IPv6 addresses:
Make sure that a web server is running on port 80 and your firewall, and security group, allow access to this port.
Step 1: Create a DNS zone
This example uses the DNS zone demo.auroradns.eu. This zone can be easily added through our Aurora DNS control panel:
Note: please make sure that the name server (NS) records are pointing to the Aurora DNS name servers. The following NS-records should therefore be in place:
Step 2: Create health checks
Aurora DNS uses health checks to constantly monitor which servers are online. Every time a DNS query is performed it will respond with only IP addresses of the online hosts. For every server of your cluster you should therefore create a health check.
We choose to create an HTTP check in this example. Aurora DNS will check for a valid response from the associated (web)servers to determine whether an IP address is marked as 'healthy'.
The full health check configuration for **web01-demo.auroradns.eu* (one of the two servers we use in this tutorial) is displayed below:
Interval: 10 seconden
This health check will check every 10 seconds whether web01-demo.auroradns.eu responds to HTTP requests on port 80. A similar check should be configured for all web servers in your cluster. We ended up creating two:
Step 3: Create DNS records and associate health checks
Our goal is that the DNS response from demo.auroradns.eu only includes IP addresses of web servers which are online (or 'healthy'). In this case should that either be the IP address of web01-demo.auroradns.eu and/or web02-demo.auroradns.eu. We therefore are going to create A and AAAA records inside the demo.auroradns.eu zone, pointing to the IPv4 and IPv6 addresses of the aforementioned web servers.
While creating the records you can directly associate the applicable health check. This is a crucial step: it enables Aurora DNS to either show or hide these records in the DNS response, depending on the result of the associated health check.
The final result will look somewhat like this:
At the time we took this screenshot web02-demo.auroradns.eu was shut off. The health check is therefore marked as 'Failed' and the associated records are disabled.
You have probably completed the aforementioned steps and therefore enabled Aurora DNS to health check your server(s) or cluster. We have also created a fully functional demo in case you have not!
Visit demo.auroradns.eu. We have created a simple web page telling you on which of the two web servers you have landed.
The two web servers will alternately be available. Through a CRON job web01-demo.auroradns.eu will stop its web server on the 30th minute of the hour and will start it again at the 55th minute. Web02-demo.auroradns.eu on the other hand will stop its web server on the 0th minute of the hour and start it again at the 25th minute. This simulates the case where we alternately 'lose' one of the two web servers.
The cool thing is: the demo page will still be available because the health check notices one of the two web servers failing and will therefore only forward you to the healthy one.