AWS Network and Route53
Published: 2022-03-07 07:55:53

**DNS**

**Register Your Domain Name**

Networking and Content Delivery - Route53 - DNS management - Get started now - Registered domains - Register Domain - Add domain name - check(check the price and all) - Add to cart - continue - Add details and Register domain name 

Create 4 EC2 instance in different region.Add this bootstrap script in configure Instance - Advance Details
Webserver -1 in Northern Virginia
Webserver -1 in Northern Virginia
Webserver -2 in Sydney
Webserver -3 in south America sauo paulo

```
#!/bin/bash
yum update -y
yum install httpd -y
cd /var/www/html
echo "webserver -1 - Northern Virginia " > index.html
service httpd start
chkconfig httpd on 
```
**Simple Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - create a Record set - add TTL second = 60 and value as 4 webservers ip address like shown below,Routing policy = simple - create(wait for sometime to service come into effect) - Now type the domain name in webbrowser - you will get the website and region from you get website might be random.

```
Public ip of Northern Virginia1
Public ip of Northern Virginia2
Public ip of Sydney
Public ip of south America sauo paulo
```

**Weighted Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - Delete simple Routing policy created earlier - create a Record set - add TTL second = 60 and value as Northern Virginia 1 webserver ip address,Routing policy = weighted,weight = 25,setID = webserver1 - create - Do the same for other 3 also(total =25%*4=100%)- wait for sometime to service come into effect - Now type the domain name in webbrowser - you will get the website according to weighted. 

**Latency Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - Delete Weighted Routing policy created earlier - create a Record set - add TTL second = 60 and value as Northern Virginia 1 webserver ip address and Northern Virginia 2 webserver ip address,Routing policy = Latency,Region automatically will come,setID = webserver1&2 - create(Do this for other two webservers and total there will be three types) - wait for sometime to service come into effect - Now type the domain name in webbrowser - you will get the website with low latency region(use VPN client to change your current network location and test the latency.If you connect to Australia in VPN and type your domain in webbrowser you get the response from sydney).

**Failover Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - Delete Latency Routing policy created earlier - Go to Health checks - create health check - Add name,what to monitor = endpoint,specify enpoint by = IP address,protocol = HTTP, IP address = public ip of Northern Virginia 1,Host name = domain name,port = 80,path = /index.html - Next - create alarm = no - create health check - wait sometime to service come into effect - Route53 - click on Hosted Zones - click on created DNS name - create a Record set - add TTL second = 60 and value as Northern Virginia 1 webserver ip address,Routing policy = Failover,Failover Record Type = Primary,setID = primary,Enable Associated with health check and add the created health check - create(Do this for Sydney and set Failover Record Type = Secondary,setID = Secondary  ) - wait for sometime to service come into effect - Now type the domain name in webbrowser - you will get the website of Northern Virginia1.If we stop the Northern Virginia1 EC2 Instance(Go to health checks status will be unhealthy) you will get the website of Sydney(secondary)

**Geolocation Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - Delete Failover Routing policy created earlier - create a Record set - add TTL second = 60 and value as Northern Virginia 1 webserver ip address,Routing policy = Geolocation,Location = North America,setID = North America set - create(Do this for sydney add TTL second = 60 and value as Sydney webserver ip address,Routing policy = Geolocation,Location = Oceana,setID = Sydney) - wait for sometime to service come into effect - Use VPN client to change your current network location to United states and Now type the domain name in webbrowser you get website of Northern Virginia1.If you connect to Australia in VPN and type your domain in webbrowser you get the website from sydney.

**Multivalue Routing Policy**

Route53 - click on Hosted Zones - click on created DNS name - Delete Geolocation Routing policy created earlier - create a Record set - add TTL second = 60 and value as Northern Virginia 1 webserver ip address,Routing policy = Multivalue,setID = web01USEAST-1 - create(Do this Northern Virginia 2 - add TTL second = 60 and value as Northern Virginia 2 webserver ip address,Routing policy = Multivalue,setID = web02USEAST-1) - wait for sometime to service come into effect - Now type the domain name in webbrowser - you will get the website random and if one EC2 Instance stopped you get website second one.