This repo contains terraform configuration to instantiate sets of anycast DNS servers with a test record hello-world.test.
We use BIND 9 and AWS Global Accelerator, amazon's anycast service.
ga_to_elb
directory.
graph LR
subgraph Global Accelerator
aws_globalaccelerator["GA"]
aws_globalaccelerator_listener["GA Listener"]
end
subgraph Per-Region Resources
aws_globalaccelerator_endpoint_group["GA Endpoint Group"]
aws_instance_01["EC2 Instance dns01"]
aws_instance_02["EC2 Instance dns02"]
end
aws_globalaccelerator --> aws_globalaccelerator_listener
aws_globalaccelerator_listener --> aws_globalaccelerator_endpoint_group
aws_globalaccelerator_endpoint_group --> aws_instance_01
aws_globalaccelerator_endpoint_group --> aws_instance_02
A GIF recording is available, below. Here are the commands used in that show & tell session:
- First you must have terraform installed, and ensure you have AWS credentials setup with adequate permission to create instances, global accelerators, and so on. I simply used a super-user account.
terraform init
to get the working directory readyterraform plan
to do a dry run and see what will happenterraform apply
to deploy your globally-anycasted name serversaws --region us-west-2 globalaccelerator list-accelerators
to show your GA's IP addresseshost hello-world.test <IP address of global accelerator>
to run a DNS query against your new server!-
⚠️ your first DNS query to the anycast address will probably fail! It may take 20 minutes for a new Global Accelerator to start functioning. The animated GIF makes it look quick, but that's Hollywood trickery. - Try that
host hello-world.test <IP address>
command again after lunch. It should succeed! terraform destroy
to tear it all down so you won't keep spending money at the rate of $1 per hour
As of 2021-11-20 the cost of this is approximately:
Component | Per-Region / Global | Cost Range / Region | Cost MRC Ext |
---|---|---|---|
Global Accelerator | Global | $18 | |
DNS Server VMs t4g.nano |
Capacity-Based Per-Region × 17 | $3.03 - $4.83 | $82.11 |
The speed at which GlobalAccelerator can scale in response to DDOS should be evaluated.